<!-- 绿色通道 - 患者列表 - 医疗记录 - 血液检查 界面 -->
<template>
  <div id="box">
    <div class="bloodContent">
      <!-- <div style="width: 100%;border-bottom: 1px solid #DFDEE3; margin-top: 15px;margin-bottom:15px" /> -->
      <!-- <div
        v-show="strokeBloodsugarList.length === 0 && strokeFourItemsBloodLipidList.length === 0 && strokeCoagulationList.length === 0 && strokeBoutineBloodTestList.length === 0
          && strokeRenalAndElectrolytesList.length === 0 && strokeOtherList.length === 0"
      >
        <center><h3>无数据</h3></center>
      </div> -->
      <div class="addContent">
        <el-button type="primary" style="float: right;margin-right: 40px;margin-top: 8px;padding: 8px 15px;"
          @click="popup">新 增</el-button>
      </div>
      <div v-show="strokeBloodsugarList.length" class="content">
        <div>
          <span style="font-size: 18px;">血糖</span>
          <div v-for="(sugarIndex, index) in strokeBloodsugarList" :key="index" class="publicStyle">
            <el-row>
              <el-col :span="10">
                <div class="grid-content bg-purple">
                  <span>抽血时间：</span>
                  <el-date-picker v-model="sugarIndex.json.bloodTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
                    size="small" placeholder="选择日期时间" />
                  <span style="margin-left:20px">报告时间：</span>
                  <el-date-picker v-model="sugarIndex.json.resultTime" type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期时间" />
                </div>
              </el-col>
              <el-col :span="14">
                <div class="grid-content bg-purple-light">
                  <span>{{ sugarIndex.createTime }}</span>
                  <!-- <span style="margin-left:20px">曲阜市人民医院</span> -->
                  <span style="margin:0 25px">{{ sugarIndex.department }}</span>
                  <span>{{ sugarIndex.doctor }}</span>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <div v-for="(orderDetailItem, indexOrder) in sugarIndex.json.orderDetail" :key="indexOrder">
                  <el-col :span="8">
                    <span>{{ orderDetailItem.abbr }} ：</span>
                    <el-input v-model="orderDetailItem.value" placeholder="" size="mini"
                      style="margin-left:10px;width:20%" />
                    <span style="margin-left:10px">{{ orderDetailItem.unit }}</span>
                  </el-col>
                </div>
              </div>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <el-col :span="24">
                  <span>备注</span><span>：</span>
                  <el-input v-model="sugarIndex.remarks" placeholder=""
                    style="margin-left:10px;width:auto;min-width:50%" />
                </el-col>
              </div>
            </el-row>
            <el-button type="primary" style="margin-left:96%;margin-top:-10px" size="mini"
              @click="saveMyocardialenzymes(sugarIndex.itemType, index, sugarIndex.remarks)">保存</el-button>
          </div>
          <div v-if="strokeBloodsugarList.length !== 1 && strokeBloodsugarList.length !== 0" class="trendContent">
            <el-button type="text" @click="goViewMyocardialenzymes()">
              <i class="el-icon-s-data" />
              <span style="margin:0 5px">趋势图</span>
            </el-button>
            <el-dialog :visible.sync="dialogVisible">
              <div v-if="dialogVisible" class="Trend">
                <div ref="chart" style="width:900px;height:500px" />
              </div>
              <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="dialogVisible = false">关 闭</el-button>
              </span>
            </el-dialog>
          </div>
        </div>
      </div>
      <div v-show="strokeFourItemsBloodLipidList.length" class="content">
        <div>
          <span style="font-size: 18px;">血脂四项</span>
          <div v-for="(fouBloodCItem, fourItemIndex) in strokeFourItemsBloodLipidList" :key="fouBloodCItem.id"
            class="publicStyle">
            <el-row>
              <el-col :span="10">
                <div class="grid-content bg-purple">
                  <span>抽血时间：</span>
                  <el-date-picker v-model="fouBloodCItem.json.bloodTime" type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期时间" />
                  <span style="margin-left:20px">报告时间：</span>
                  <el-date-picker v-model="fouBloodCItem.json.resultTime" type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期时间" />
                </div>
              </el-col>
              <el-col :span="14">
                <div class="grid-content bg-purple-light">
                  <span style="margin:0 25px 0 30%">{{ fouBloodCItem.createTime }}</span>
                  <!-- <span>曲阜市人民医院</span> -->
                  <span style="margin:0 25px">{{ fouBloodCItem.department }}</span>
                  <span>{{ fouBloodCItem.doctor }}</span>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <div v-for="(fourOrderItem, fourIndex) in fouBloodCItem.json.orderDetail" :key="fourIndex"
                  style="float:left">
                  <span>{{ fourOrderItem.abbr }}</span>
                  <el-input v-model="fourOrderItem.value" placeholder="" size="mini"
                    style="margin-left:10px;width:30%" />
                  <span style="margin-left:10px">{{ fourOrderItem.unit }}</span>
                </div>
              </div>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <el-col :span="24">
                  <span>备注</span><span> ：</span>
                  <el-input v-model="fouBloodCItem.remarks" placeholder=""
                    style="margin-left:10px;width:auto;min-width:50%" />
                </el-col>
              </div>
            </el-row>
            <el-button type="primary" style="margin-left:96%" size="mini"
              @click="saveMyocardialenzymes(fouBloodCItem.itemType, fourItemIndex, fouBloodCItem.remarks)">保存</el-button>
          </div>
          <div v-if="strokeFourItemsBloodLipidList.length !== 1 && strokeFourItemsBloodLipidList.length !== 0"
            class="trendContent">
            <el-button type="text" @click="goViewFourItemsBloodCoagulation()">
              <i class="el-icon-s-data" />
              <span style="margin:0 5px">趋势图</span>
            </el-button>
            <el-dialog :visible.sync="dialogVisible">
              <div v-if="dialogVisible" class="Trend">
                <div ref="chart" style="width:900px;height:500px" />
              </div>
              <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="dialogVisible = false">关 闭</el-button>
              </span>
            </el-dialog>
          </div>
        </div>
      </div>
      <div v-show="strokeCoagulationList.length" class="content">
        <div>
          <span style="font-size: 18px;">凝血功能</span>
          <div v-for="(routineItem, routIndex) in strokeCoagulationList" :key="routIndex" class="publicStyle">
            <el-row>
              <el-col :span="10">
                <div class="grid-content bg-purple">
                  <span>抽血时间：</span>
                  <el-date-picker v-model="routineItem.json.bloodTime" type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期时间" />
                  <span style="margin-left:20px">报告时间：</span>
                  <el-date-picker v-model="routineItem.json.resultTime" type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期时间" />
                </div>
              </el-col>
              <el-col :span="14">
                <div class="grid-content bg-purple-light">
                  <span style="margin:0 25px 0 30%">{{ routineItem.createTime }}</span>
                  <!-- <span>曲阜市人民医院</span> -->
                  <span style="margin:0 25px">{{ routineItem.department }}</span>
                  <span>{{ routineItem.doctor }}</span>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <div v-for="(routineOrderItem, rOrderIndex) in routineItem.json.orderDetail" :key="rOrderIndex"
                  style="float:left;margin-top:5px">
                  <span>{{ routineOrderItem.abbr }}</span>
                  <el-input v-model="routineOrderItem.value" placeholder="" size="mini"
                    style="margin-left:10px;width:30%" />
                  <span style="margin-left:10px">{{ routineOrderItem.unit }}</span>
                </div>
              </div>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <el-col :span="24">
                  <span>备注</span><span> ：</span>
                  <el-input v-model="routineItem.remarks" placeholder=""
                    style="margin-left:10px;width:auto;min-width:50%" />
                </el-col>
              </div>
            </el-row>
            <el-button type="primary" style="margin-left:96%" size="mini"
              @click="saveMyocardialenzymes(routineItem.itemType, routIndex, routineItem.remarks)">保存</el-button>
          </div>
          <div v-if="strokeCoagulationList.length !== 1 && strokeCoagulationList.length !== 0" class="trendContent">
            <el-button type="text" @click="goViewbloodRoutineExamination()">
              <i class="el-icon-s-data" />
              <span style="margin:0 5px">趋势图</span>
            </el-button>
            <el-dialog :visible.sync="dialogVisible">
              <div v-if="dialogVisible" class="Trend">
                <div ref="chart" style="width:900px;height:500px" />
              </div>
              <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="dialogVisible = false">关 闭</el-button>
              </span>
            </el-dialog>
          </div>
        </div>
      </div>
      <div v-show="strokeBoutineBloodTestList.length" class="content">
        <div>
          <span style="font-size: 18px;">血常规</span>
          <div v-for="(serumCreatinineItem, serumCreatIndex) in strokeBoutineBloodTestList" :key="serumCreatIndex"
            class="publicStyle">
            <el-row>
              <el-col :span="10">
                <div class="grid-content bg-purple">
                  <span>抽血时间：</span>
                  <el-date-picker v-model="serumCreatinineItem.json.bloodTime" type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期时间" />
                  <span style="margin-left:20px">报告时间：</span>
                  <el-date-picker v-model="serumCreatinineItem.json.resultTime" type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期时间" />
                </div>
              </el-col>
              <el-col :span="14">
                <div class="grid-content bg-purple-light">
                  <span style="margin:0 25px 0 30%">{{ serumCreatinineItem.createTime }}</span>
                  <!-- <span>曲阜市人民医院</span> -->
                  <span style="margin:0 25px">{{ serumCreatinineItem.department }}</span>
                  <span>{{ serumCreatinineItem.doctor }}</span>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <div v-for="(serumCreatOrderItem, serumOrderIndex) in serumCreatinineItem.json.orderDetail"
                  v-if="routinebloodNameList.filter(el=> el.abbr === serumCreatOrderItem.abbr).length>0" :key="serumOrderIndex" style="float:left">
                  <span>{{ serumCreatOrderItem.abbr }} ：</span>
                  <el-input v-model="serumCreatOrderItem.value" placeholder="" size="mini"
                    style="margin-left:10px;width:30%" />
                  <span style="margin-left:10px">{{ serumCreatOrderItem.unit }}</span>
                </div>
              </div>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <el-col :span="24">
                  <span>备注</span><span> ：</span>
                  <el-input v-model="serumCreatinineItem.remarks" placeholder=""
                    style="margin-left:10px;width:auto;min-width:50%" />
                </el-col>
              </div>
            </el-row>
            <el-button type="primary" style="margin-left:96%" size="mini"
              @click="saveMyocardialenzymes(serumCreatinineItem.itemType, serumCreatIndex, serumCreatinineItem.remarks)">保存</el-button>
          </div>
          <div v-if="strokeBoutineBloodTestList.length !== 1 && strokeBoutineBloodTestList.length !== 0"
            class="trendContent">
            <el-button type="text" @click="goViewSerumCreatinine()">
              <i class="el-icon-s-data" />
              <span style="margin:0 5px">趋势图</span>
            </el-button>
            <el-dialog :visible.sync="dialogVisible" width="50%">
              <div v-if="dialogVisible" class="Trend">
                <div ref="chart" style="width:900px;height:500px" />
              </div>
              <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="dialogVisible = false">关 闭</el-button>
              </span>
            </el-dialog>
          </div>
        </div>
      </div>
      <div v-show="strokeRenalAndElectrolytesList.length" class="content">
        <div>
          <span style="font-size: 18px;">肾功能及电解质</span>
          <div v-for="(RenalAndElectrolytesItem, serumCreatIndex) in strokeRenalAndElectrolytesList"
            :key="serumCreatIndex" class="publicStyle">
            <el-row>
              <el-col :span="10">
                <div class="grid-content bg-purple">
                  <span>抽血时间：</span>
                  <el-date-picker v-model="RenalAndElectrolytesItem.json.bloodTime" type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期时间" />
                  <span style="margin-left:20px">报告时间：</span>
                  <el-date-picker v-model="RenalAndElectrolytesItem.json.resultTime" type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期时间" />
                </div>
              </el-col>
              <el-col :span="14">
                <div class="grid-content bg-purple-light">
                  <span style="margin:0 25px 0 30%">{{ RenalAndElectrolytesItem.createTime }}</span>
                  <!-- <span>曲阜市人民医院</span> -->
                  <span style="margin:0 25px">{{ RenalAndElectrolytesItem.department }}</span>
                  <span>{{ RenalAndElectrolytesItem.doctor }}</span>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <div v-for="(serumCreatOrderItem, serumOrderIndex) in RenalAndElectrolytesItem.json.orderDetail"
                  :key="serumOrderIndex" style="float:left">
                  <span>{{ serumCreatOrderItem.abbr }} ：</span>
                  <el-input v-model="serumCreatOrderItem.value" placeholder="" size="mini"
                    style="margin-left:10px;width:30%" />
                  <span style="margin-left:10px">{{ serumCreatOrderItem.unit }}</span>
                </div>
              </div>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <el-col :span="24">
                  <span>备注</span><span> ：</span>
                  <el-input v-model="RenalAndElectrolytesItem.remarks" placeholder=""
                    style="margin-left:10px;width:auto;min-width:50%" />
                </el-col>
              </div>
            </el-row>
            <el-button type="primary" style="margin-left:96%" size="mini"
              @click="saveMyocardialenzymes(RenalAndElectrolytesItem.itemType, serumCreatIndex, RenalAndElectrolytesItem.remarks)">保存</el-button>
          </div>
          <div v-if="strokeRenalAndElectrolytesList.length !== 1 && strokeRenalAndElectrolytesList.length !== 0"
            class="trendContent">
            <el-button type="text" @click="goViewRenalAndElectrolytes()">
              <i class="el-icon-s-data" />
              <span style="margin:0 5px">趋势图</span>
            </el-button>
            <el-dialog :visible.sync="dialogVisible" width="50%">
              <div v-if="dialogVisible" class="Trend">
                <div ref="chart" style="width:900px;height:500px" />
              </div>
              <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="dialogVisible = false">关 闭</el-button>
              </span>
            </el-dialog>
          </div>
        </div>
      </div>
      <div v-show="strokeMyocardialEnzymeList.length" class="content">
        <div>
          <span style="font-size: 18px;">心肌酶</span>
          <div v-for="(OtherItem, serumCreatIndex) in strokeMyocardialEnzymeList" :key="serumCreatIndex"
            class="publicStyle">
            <el-row>
              <el-col :span="10">
                <div class="grid-content bg-purple">
                  <span>抽血时间：</span>
                  <el-date-picker v-model="OtherItem.json.bloodTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
                    size="small" placeholder="选择日期时间" />
                  <span style="margin-left:20px">报告时间：</span>
                  <el-date-picker v-model="OtherItem.json.resultTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
                    size="small" placeholder="选择日期时间" />
                </div>
              </el-col>
              <el-col :span="14">
                <div class="grid-content bg-purple-light">
                  <span style="margin:0 25px 0 30%">{{ OtherItem.createTime }}</span>
                  <!-- <span>曲阜市人民医院</span> -->
                  <span style="margin:0 25px">{{ OtherItem.department }}</span>
                  <span>{{ OtherItem.doctor }}</span>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <div v-for="(serumCreatOrderItem, serumOrderIndex) in OtherItem.json.orderDetail" :key="serumOrderIndex"
                  style="float:left">
                  <span>{{ serumCreatOrderItem.abbr }} ：</span>
                  <el-input v-model="serumCreatOrderItem.value" placeholder="" size="mini"
                    style="margin-left:10px;width:30%" />
                  <span style="margin-left:10px">{{ serumCreatOrderItem.unit }}</span>
                </div>
              </div>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <el-col :span="24">
                  <span>备注</span><span> ：</span>
                  <el-input v-model="OtherItem.remarks" placeholder=""
                    style="margin-left:10px;width:auto;min-width:50%" />
                </el-col>
              </div>
            </el-row>
            <el-button type="primary" style="margin-left:96%" size="mini"
              @click="saveMyocardialenzymes(OtherItem.itemType, serumCreatIndex, OtherItem.remarks)">保存</el-button>
          </div>
          <div v-if="strokeMyocardialEnzymeList.length !== 1 && strokeMyocardialEnzymeList.length !== 0"
            class="trendContent">
            <el-button type="text" @click="goViewstrokeMyocardialEnzyme()">
              <i class="el-icon-s-data" />
              <span style="margin:0 5px">趋势图</span>
            </el-button>
            <el-dialog :visible.sync="dialogVisible" width="50%">
              <div v-if="dialogVisible" class="Trend">
                <div ref="chart" style="width:900px;height:500px" />
              </div>
              <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="dialogVisible = false">关 闭</el-button>
              </span>
            </el-dialog>
          </div>
        </div>
      </div>
      <div v-show="strokeOtherList.length" class="content">
        <div>
          <span style="font-size: 18px;">其他</span>
          <div v-for="(OtherItem, serumCreatIndex) in strokeOtherList" :key="serumCreatIndex" class="publicStyle">
            <el-row>
              <el-col :span="10">
                <div class="grid-content bg-purple">
                  <span>抽血时间：</span>
                  <el-date-picker v-model="OtherItem.json.bloodTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
                    size="small" placeholder="选择日期时间" />
                  <span style="margin-left:20px">报告时间：</span>
                  <el-date-picker v-model="OtherItem.json.resultTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
                    size="small" placeholder="选择日期时间" />
                </div>
              </el-col>
              <el-col :span="14">
                <div class="grid-content bg-purple-light">
                  <span style="margin:0 25px 0 30%">{{ OtherItem.createTime }}</span>
                  <!-- <span>曲阜市人民医院</span> -->
                  <span style="margin:0 25px">{{ OtherItem.department }}</span>
                  <span>{{ OtherItem.doctor }}</span>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <div v-for="(serumCreatOrderItem, serumOrderIndex) in OtherItem.json.orderDetail" :key="serumOrderIndex"
                  style="float:left">
                  <span>{{ serumCreatOrderItem.abbr }} ：</span>
                  <el-input v-model="serumCreatOrderItem.value" placeholder="" size="mini"
                    style="margin-left:10px;width:30%" />
                  <span style="margin-left:10px">{{ serumCreatOrderItem.unit }}</span>
                </div>
              </div>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <el-col :span="24">
                  <span>备注</span><span> ：</span>
                  <el-input v-model="OtherItem.remarks" placeholder=""
                    style="margin-left:10px;width:auto;min-width:50%" />
                </el-col>
              </div>
            </el-row>
            <el-button type="primary" style="margin-left:96%" size="mini"
              @click="saveMyocardialenzymes(OtherItem.itemType, serumCreatIndex, OtherItem.remarks)">保存</el-button>
          </div>
          <div v-if="strokeOtherList.length !== 1 && strokeOtherList.length !== 0" class="trendContent">
            <el-button type="text" @click="goViewstrokeOther()">
              <i class="el-icon-s-data" />
              <span style="margin:0 5px">趋势图</span>
            </el-button>
            <el-dialog :visible.sync="dialogVisible" width="50%">
              <div v-if="dialogVisible" class="Trend">
                <div ref="chart" style="width:900px;height:500px" />
              </div>
              <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="dialogVisible = false">关 闭</el-button>
              </span>
            </el-dialog>
          </div>
        </div>
      </div>
    </div>
    <el-dialog title="新增血液检查" :visible.sync="newincalogase" width="60%" :before-close="handleClose">
      <el-tabs v-model="editableTabsValue" type="card" @tab-click="clickTab">
        <el-tab-pane v-for="(item, index) in editableTabs" :key="item.name" :label="item.title" :name="item.name">
          <!--关键代码，这个div里通过判断item.show的值来控制只把当前tab页渲染到dom树中-->
          <div v-if="item.show === true">
            <el-form ref="table_url" :model="item.request_tab_data" label-position="left" :rules="rules"
              label-width="240px" style="overflow: auto;height: 420px;padding: 5px 20px;">
              <!--由于外层有v-if控制dom树只存在当前tab页，所以不用:prop，直接用官方示例中的prop-->
              <!-- <el-form-item label="抽血时间 :" prop="drawbloodTime"> -->
              <el-form-item label="抽血时间 :">
                <el-date-picker v-model="item.request_tab_data.drawbloodTime" type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期时间" />
              </el-form-item>
              <!-- <el-form-item label="报告时间 :" prop="reportTime"> -->

              <el-form-item label="报告时间 :">
                <el-date-picker v-model="item.request_tab_data.reportTime" type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期时间" />
              </el-form-item>
              <div v-if="item.name === 'strokeBloodsugar'">
                <el-form-item v-for="(sub, index) in bloodsugarNameList" :key="index" :prop="sub.type"
                  :label="sub.abbr + ' (' + sub.unit + ')' + ' :'">
                  <el-input v-model="sub.value" />
                </el-form-item>
              </div>
              <div v-if="item.name === 'strokeFourItemsBloodLipid'">
                <el-form-item v-for="(sub, index) in bloodfatNameList" :key="index" :prop="sub.type"
                  :label="sub.abbr + ' (' + sub.unit + ')' + ' :'">
                  <el-input v-model="sub.value" />
                </el-form-item>
              </div>
              <div v-if="item.name === 'strokeCoagulation'">
                <el-form-item v-for="(sub, index) in CoagulationNameList" :key="index" :prop="sub.type"
                  :label="sub.abbr + ' (' + sub.unit + ')' + ' :'">
                  <el-input v-model="sub.value" />
                </el-form-item>
              </div>
              <div v-if="item.name === 'strokeBoutineBloodTest'">
                <el-form-item v-for="(sub, index) in routinebloodNameList" :key="index" :prop="sub.type"
                  :label="sub.abbr + ' (' + sub.unit + ')' + ' :'">
                  <el-input v-model="sub.value" />
                </el-form-item>
              </div>
              <div v-if="item.name === 'strokeRenalAndElectrolytes'">
                <el-form-item v-for="(sub, index) in renalelectrolyteNameList" :key="index" :prop="sub.type"
                  :label="sub.abbr + ' (' + sub.unit + ')' + ' :'">
                  <el-input v-model="sub.value" />
                </el-form-item>
              </div>

              <div v-if="item.name === 'MyocardialEnzyme'">
                <el-form-item v-for="(sub, index) in myocardialEnzymeNameList" :key="index" :prop="sub.type"
                  :label="sub.abbr + ' (' + sub.unit + ')' + ' :'">
                  <el-input v-model="sub.value" />
                </el-form-item>
              </div>

              <div v-if="item.name === 'strokeOther'">
                <el-form-item v-for="(sub, index) in otherNameList" :key="index" :prop="sub.type"
                  :label="sub.abbr + ' (' + sub.unit + ')' + ' :'">
                  <el-input v-model="sub.value" />
                </el-form-item>
              </div>
              <el-form-item label="备注 :" prop="remarks">
                <el-input v-model="item.request_tab_data.remarks" type="textarea" />
              </el-form-item>
            </el-form>
          </div>
        </el-tab-pane>
      </el-tabs>
      <span slot="footer" class="dialog-footer">
        <el-button @click="rf('table_url', editableTabsValue)">重 置</el-button>
        <el-button style="margin-left: 40px;" type="primary" @click="tj('table_url', editableTabsValue)">保 存</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import echarts from 'echarts'
import {
  queryBloodDataStroke,
  StrokeBloodnew,
  coagulation,
  routineblood,
  saveBloodnew,
  getAllOnUseTesttarget
} from '@/api/green-channel/bloodExaminationStroke'

import { getPatientStroke } from '@/api/green-channel/info'

export default {
  // 由主页面(父组件) 接收来的, 选择项的数据
  props: ['checkrowdata'], // 由主页面(父组件) 接收来的, 选择项的数据
  data() {
    return {
      editableTabsValue: 'strokeBloodsugar',
      editableTabs: [
        {
          title: '血糖',
          name: 'strokeBloodsugar',
          show: true, // 控制dom中只存在当前选择的tab页
          request_tab_data: {
            drawbloodTime: '',
            reportTime: '',
            remarks: ''
          }
        }, {
          title: '血脂四项',
          name: 'strokeFourItemsBloodLipid',
          show: false, // 控制dom中只存在当前选择的tab页
          request_tab_data: {
            drawbloodTime: '',
            reportTime: '',
            remarks: ''
          }
        }, {
          title: '凝血功能',
          name: 'strokeCoagulation',
          show: false, // 控制dom中只存在当前选择的tab页
          request_tab_data: {
            drawbloodTime: '',
            reportTime: '',
            remarks: ''
          }
        }, {
          title: '血常规',
          name: 'strokeBoutineBloodTest',
          show: false, // 控制dom中只存在当前选择的tab页
          request_tab_data: {
            drawbloodTime: '',
            reportTime: '',
            remarks: ''
          }
        }, {
          title: '肾功能及电解质',
          name: 'strokeRenalAndElectrolytes',
          show: false, // 控制dom中只存在当前选择的tab页
          request_tab_data: {
            drawbloodTime: '',
            reportTime: '',
            remarks: ''
          }
        }, {
          title: '心肌酶',
          name: 'MyocardialEnzyme',
          show: false, // 控制dom中只存在当前选择的tab页
          request_tab_data: {
            drawbloodTime: '',
            reportTime: '',
            remarks: ''
          }
        }, {
          title: '其他',
          name: 'strokeOther',
          show: false, // 控制dom中只存在当前选择的tab页
          request_tab_data: {
            drawbloodTime: '',
            reportTime: '',
            remarks: ''
          }
        }
      ],
      // 表单验证规则
      rules: {
        // drawbloodTime: [{
        //   required: true,
        //   message: '必须填写抽血时间',
        //   trigger: 'blur'
        // }],
        // reportTime: [{
        //   required: true,
        //   message: '必须填写报告时间',
        //   trigger: 'blur'
        // }]
      },
      /* 新增------------------- */
      newincalogase: false,

      // 检测项目列表
      allOnUse: [],
      bloodsugarNameList: [],
      bloodfatNameList: [],
      CoagulationNameList: [],
      routinebloodNameList: [],
      renalelectrolyteNameList: [],
      myocardialEnzymeNameList: [],
      otherNameList: [],
      bloodsugarNameListcopy: [],
      bloodfatNameListcopy: [],
      CoagulationNameListcopy: [],
      routinebloodNameListcopy: [],
      renalelectrolyteNameListcopy: [],
      myocardialEnzymeNameListcopy: [],
      otherNameListcopy: [],

      /* end------------------- */
      dialogVisible: false, // 趋势图
      instanceTypeList: [
        'strokeBloodsugar',
        'strokeFourItemsBloodLipid',
        'strokeCoagulation',
        'strokeBoutineBloodTest',
        'strokeRenalAndElectrolytes',
        'strokeBioChemistry',
        'MyocardialEnzyme'
        // 'strokeOther'
      ], // 查询接口类型
      strokeBloodsugarList: [], // 血糖
      strokeFourItemsBloodLipidList: [], // 血脂四项
      strokeCoagulationList: [], // 凝血功能
      strokeBoutineBloodTestList: [], // 血常规
      strokeRenalAndElectrolytesList: [], // 肾功能及电解质
      strokeOtherList: [], // 其他
      strokeMyocardialEnzymeList: [], // 心肌酶
      firstMedicalContactDateTime: '' // 首次接诊医疗接触时间
    }
  },
  computed: {},
  updated() { },
  created() {
    this.init()
  },
  methods: {
    init() {
      this.getBloodDataStroke()
      this.getAllOnUseTesttarget()
      this.getPatientInfo()
    },
    tj(formName, editableTabsValue) {
      let instance = ''
      this.$refs[formName][0].validate(valid => {
        if (valid) {
          // 业务逻辑...
          const jsonObj = {}
          let data = {}
          this.editableTabs.forEach((res) => {
            if (res.name === editableTabsValue) {
              let domains = []
              let itemType = ''
              if (editableTabsValue === 'strokeBloodsugar') {
                instance = 'bloodsugar'
                this.bloodsugarNameList.forEach((sub) => {
                  if (sub.value !== '') {
                    this.allOnUse.forEach(alone => {
                      if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏高'
                        } else if (Number(sub.value) < Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏低'
                        } else {
                          sub.judgement = '正常'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '正常'
                        } else {
                          sub.judgement = '偏低'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏高'
                        } else {
                          sub.judgement = '正常'
                        }
                      }
                    })
                  }
                })
                itemType = 'bloodsugar'
                domains = this.bloodsugarNameList
                // .filter((item, i) => {
                //   return item.value !== ''
                // })
                data = {
                  id: null,
                  userId: this.$store.getters.userId,
                  doctor: this.$store.getters.name,
                  department: this.$store.getters.deptment,
                  missionId: this.checkrowdata.dispatchId,
                  medicalId: this.checkrowdata.medicalId,
                  instanceType: editableTabsValue,
                  itemName: res.title,
                  itemType: itemType,
                  polarity: 0,
                  // json: JSON.stringify(jsonObj),
                  bs: domains[0] ? domains[0].value ? domains[0].value : '' : '',
                  bs_u: domains[0] ? domains[0].unit ? domains[0].unit : '' : '',
                  bs_i: domains[0] ? domains[0].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '',
                  hba1c: domains[1] ? domains[1].value ? domains[1].value : '' : '',
                  hba1c_u: domains[1] ? domains[1].unit ? domains[1].unit : '' : '',
                  hba1c_i: domains[1] ? domains[1].judgement === '偏低' ? 'L' : domains[1].judgement === '偏高' ? 'H' : '' : '',
                  excuteTime: res.request_tab_data.drawbloodTime,
                  reportTime: res.request_tab_data.reportTime,
                  remarks: res.request_tab_data.remarks,
                  version: 0,
                  status: 1
                }
              } else if (editableTabsValue === 'strokeFourItemsBloodLipid') {
                instance = 'bloodlipid'
                this.bloodfatNameList.forEach((sub) => {
                  if (sub.value !== '') {
                    this.allOnUse.forEach(alone => {
                      if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏高'
                        } else if (Number(sub.value) < Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏低'
                        } else {
                          sub.judgement = '正常'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '正常'
                        } else {
                          sub.judgement = '偏低'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏高'
                        } else {
                          sub.judgement = '正常'
                        }
                      }
                    })
                  }
                })
                itemType = 'fourItemsBloodLipidmission'
                domains = this.bloodfatNameList
                // .filter((item, i) => {
                //   return item.value !== ''
                // })
                data = {
                  id: null,
                  userId: this.$store.getters.userId,
                  doctor: this.$store.getters.name,
                  department: this.$store.getters.deptment,
                  missionId: this.checkrowdata.dispatchId,
                  medicalId: this.checkrowdata.medicalId,
                  instanceType: editableTabsValue,
                  itemName: res.title,
                  itemType: itemType,
                  polarity: 0,
                  // json: JSON.stringify(jsonObj),
                  trig: domains[0] ? domains[0].value ? domains[0].value : '' : '',
                  trig_u: domains[0] ? domains[0].unit ? domains[0].unit : '' : '',
                  trig_i: domains[0] ? domains[0].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '',

                  chol: domains[1] ? domains[1].value ? domains[1].value : '' : '',
                  chol_u: domains[1] ? domains[1].unit ? domains[1].unit : '' : '',
                  chol_i: domains[1] ? domains[1].judgement === '偏低' ? 'L' : domains[1].judgement === '偏高' ? 'H' : '' : '',
                  ldl: domains[2] ? domains[2].value ? domains[2].value : '' : '',
                  ldl_u: domains[2] ? domains[2].unit ? domains[2].unit : '' : '',
                  ldl_i: domains[2] ? domains[2].judgement === '偏低' ? 'L' : domains[2].judgement === '偏高' ? 'H' : '' : '',
                  hdl: domains[3] ? domains[3].value ? domains[3].value : '' : '',
                  hdl_u: domains[3] ? domains[3].unit ? domains[3].unit : '' : '',
                  hdl_i: domains[3] ? domains[3].judgement === '偏低' ? 'L' : domains[3].judgement === '偏高' ? 'H' : '' : '',
                  excuteTime: res.request_tab_data.drawbloodTime,
                  reportTime: res.request_tab_data.reportTime,
                  remarks: res.request_tab_data.remarks,
                  version: 0,
                  status: 1
                }
              } else if (editableTabsValue === 'strokeCoagulation') {
                instance = 'coagulation'
                this.CoagulationNameList.forEach((sub) => {
                  if (sub.value !== '') {
                    this.allOnUse.forEach(alone => {
                      if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏高'
                        } else if (Number(sub.value) < Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏低'
                        } else {
                          sub.judgement = '正常'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '正常'
                        } else {
                          sub.judgement = '偏低'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏高'
                        } else {
                          sub.judgement = '正常'
                        }
                      }
                    })
                  }
                })
                itemType = 'coagulation'
                domains = this.CoagulationNameList
                // .filter((item, i) => {
                //   return item.value !== ''
                // })
              } else if (editableTabsValue === 'strokeBoutineBloodTest') {
                instance = 'routineblood'
                this.routinebloodNameList.forEach((sub) => {
                  if (sub.value !== '') {
                    this.allOnUse.forEach(alone => {
                      if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏高'
                        } else if (Number(sub.value) < Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏低'
                        } else {
                          sub.judgement = '正常'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '正常'
                        } else {
                          sub.judgement = '偏低'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏高'
                        } else {
                          sub.judgement = '正常'
                        }
                      }
                    })
                  }
                })
                itemType = 'boutineBloodTest'
                domains = this.routinebloodNameList
                // .filter((item, i) => {
                //   return item.value !== ''
                // })
                data = {
                  id: null,
                  userId: this.$store.getters.userId,
                  doctor: this.$store.getters.name,
                  department: this.$store.getters.deptment,
                  missionId: this.checkrowdata.dispatchId,
                  medicalId: this.checkrowdata.medicalId,
                  instanceType: editableTabsValue,
                  itemName: res.title,
                  itemType: itemType,
                  polarity: 0,
                  // json: JSON.stringify(jsonObj),
                  prothrombinTime: domains[0] ? domains[0].value ? domains[0].value : '' : '',
                  prothrombinTime_i: domains[0] ? domains[0].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '',
                  thromboplastin: domains[1] ? domains[1].value ? domains[1].value : '' : '',
                  thromboplastin_i: domains[1] ? domains[1].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '',
                  thrombinTime_i: domains[2] ? domains[2].value ? domains[2].value : '' : '',
                  thrombinTime: domains[2] ? domains[2].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '',
                  fibrinogen: domains[3] ? domains[3].value ? domains[3].value : '' : '',
                  fibrinogen_i: domains[3] ? domains[3].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '',
                  inr: domains[4] ? domains[4].value ? domains[4].value : '' : '',
                  inr_i: domains[4] ? domains[4].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '',
                  hasAudio: false,
                  excuteTime: res.request_tab_data.drawbloodTime,
                  reportTime: res.request_tab_data.reportTime,
                  remarks: res.request_tab_data.remarks,
                  version: 0,
                  status: 1
                }
              } else if (editableTabsValue === 'strokeRenalAndElectrolytes') {
                instance = 'renalelec'
                this.renalelectrolyteNameList.forEach((sub) => {
                  if (sub.value !== '') {
                    this.allOnUse.forEach(alone => {
                      if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏高'
                        } else if (Number(sub.value) < Number(alone.normalRangeStart)) {
                          sub.judgement = '偏低'
                        } else {
                          sub.judgement = '正常'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                        if (Number(sub.value) > Number(alone.normalRangeStart)) {
                          sub.judgement = '正常'
                        } else {
                          sub.judgement = '偏低'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏高'
                        } else {
                          sub.judgement = '正常'
                        }
                      }
                    })
                  }
                })
                itemType = 'renalAndElectrolytes'
                domains = this.renalelectrolyteNameList
                // .filter((item, i) => {
                //   return item.value !== ''
                // })
                data = {
                  id: null,
                  userId: this.$store.getters.userId,
                  doctor: this.$store.getters.name,
                  department: this.$store.getters.deptment,
                  missionId: this.checkrowdata.dispatchId,
                  medicalId: this.checkrowdata.medicalId,
                  instanceType: editableTabsValue,
                  itemName: res.title,
                  itemType: itemType,
                  polarity: 0,
                  // json: JSON.stringify(jsonObj),
                  crea: domains[0] ? domains[0].value ? domains[0].value : '' : '', // varchar(16) DEFAULT '' comment '血清肌酐',
                  crea_i: domains[0] ? domains[0].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '血清肌酐',
                  un: domains[1] ? domains[1].value ? domains[1].value : '' : '', // varchar(16) DEFAULT '' comment '血清尿素氮',
                  un_i: domains[1] ? domains[1].judgement === '偏低' ? 'L' : domains[1].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '血清尿素氮',
                  ua: domains[2] ? domains[2].value ? domains[2].value : '' : '', // varchar(16) DEFAULT '' comment '尿酸',
                  ua_i: domains[2] ? domains[2].judgement === '偏低' ? 'L' : domains[2].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '尿酸',
                  ka: domains[3] ? domains[3].value ? domains[3].value : '' : '', // varchar(16) DEFAULT '' comment '钾',
                  ka_i: domains[3] ? domains[3].judgement === '偏低' ? 'L' : domains[3].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '钾',
                  na: domains[4] ? domains[4].value ? domains[4].value : '' : '', // varchar(16) DEFAULT '' comment '钠',
                  na_i: domains[4] ? domains[4].judgement === '偏低' ? 'L' : domains[4].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '钠',
                  cl: domains[5] ? domains[5].value ? domains[5].value : '' : '', // varchar(16) DEFAULT '' comment ' 氯',
                  cl_i: domains[5] ? domains[5].judgement === '偏低' ? 'L' : domains[5].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '氯',
                  ga: domains[6] ? domains[6].value ? domains[6].value : '' : '', // varchar(16) DEFAULT '' comment '钙',
                  ga_i: domains[6] ? domains[6].judgement === '偏低' ? 'L' : domains[6].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '钙',
                  iop: domains[7] ? domains[7].value ? domains[7].value : '' : '', // varchar(16) DEFAULT '' comment ' 无机磷',
                  iop_i: domains[7] ? domains[7].judgement === '偏低' ? 'L' : domains[7].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '无机磷'',
                  mg: domains[8] ? domains[8].value ? domains[8].value : '' : '', // varchar(16) DEFAULT '' comment ' 镁',
                  mg_i: domains[8] ? domains[8].judgement === '偏低' ? 'L' : domains[8].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '镁',
                  excuteTime: res.request_tab_data.drawbloodTime,
                  reportTime: res.request_tab_data.reportTime,
                  remarks: res.request_tab_data.remarks,
                  version: 0,
                  status: 1
                }
              } else if (editableTabsValue === 'MyocardialEnzyme') {
                instance = 'myocardialenzyme'
                this.myocardialEnzymeNameList.forEach((sub) => {
                  if (sub.value !== '') {
                    this.allOnUse.forEach(alone => {
                      if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏高'
                        } else if (Number(sub.value) < Number(alone.normalRangeStart)) {
                          sub.judgement = '偏低'
                        } else {
                          sub.judgement = '正常'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                        if (Number(sub.value) > Number(alone.normalRangeStart)) {
                          sub.judgement = '正常'
                        } else {
                          sub.judgement = '偏低'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏高'
                        } else {
                          sub.judgement = '正常'
                        }
                      }
                    })
                  }
                })
                itemType = 'MyocardialEnzyme'
                domains = this.myocardialEnzymeNameList
                // .filter((item, i) => {
                //   return item.value !== ''
                // })
                // {"bloodTime":"2021-08-20 14:43:56","resultTime":"2021-08-20 14:43:56","orderDetail":
                // [{"judgement":"","unit":"U/L","abbr":"肌酸激酶","type":"ck","value":"19(LDR)"},
                // {"judgement":"","unit":"U/L","abbr":"羟基丁酸脱氢酶","type":"hbdh","value":"<=5(LDR)*"},
                // {"judgement":"","unit":"U/L","abbr":"肌酸激酶同工酶","type":"ckmb","value":"13.9"},
                // {"judgement":"L","unit":"U/L","abbr":"乳酸脱氢酶","type":"ldh","value":"38"}]}
                data = {
                  id: null,
                  userId: this.$store.getters.userId,
                  doctor: this.$store.getters.name,
                  department: this.$store.getters.deptment,
                  missionId: this.checkrowdata.dispatchId,
                  medicalId: this.checkrowdata.medicalId,
                  instanceType: editableTabsValue,
                  itemName: res.title,
                  itemType: itemType,
                  polarity: 0,
                  // json: JSON.stringify(jsonObj),
                  hbdh: domains[0] ? domains[0].value ? domains[0].value : '' : '',
                  hbdh_i: domains[0] ? domains[0].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '',
                  hbdh_u: domains[0] ? domains[0].unit ? domains[0].unit : '' : '',
                  ck: domains[1] ? domains[1].value ? domains[1].value : '' : '',
                  ck_i: domains[1] ? domains[1].judgement === '偏低' ? 'L' : domains[1].judgement === '偏高' ? 'H' : '' : '',
                  ck_u: domains[1] ? domains[1].unit ? domains[1].unit : '' : '',
                  ckmb: domains[2] ? domains[2].value ? domains[2].value : '' : '',
                  ckmb_i: domains[2] ? domains[2].judgement === '偏低' ? 'L' : domains[2].judgement === '偏高' ? 'H' : '' : '',
                  ckmb_u: domains[2] ? domains[2].unit ? domains[2].unit : '' : '',
                  ldh: domains[3] ? domains[3].value ? domains[3].value : '' : '',
                  ldh_i: domains[3] ? domains[3].judgement === '偏低' ? 'L' : domains[3].judgement === '偏高' ? 'H' : '' : '',
                  ldh_u: domains[3] ? domains[3].unit ? domains[3].unit : '' : '',
                  excuteTime: res.request_tab_data.drawbloodTime,
                  reportTime: res.request_tab_data.reportTime,
                  remarks: res.request_tab_data.remarks,
                  version: 0,
                  status: 1
                }
              } else if (editableTabsValue === 'strokeOther') {
                instance = 'biochemistry'
                this.otherNameList.forEach((sub) => {
                  if (sub.value !== '') {
                    this.allOnUse.forEach(alone => {
                      if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏高'
                        } else if (Number(sub.value) < Number(alone.normalRangeStart)) {
                          sub.judgement = '偏低'
                        } else {
                          sub.judgement = '正常'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                        if (Number(sub.value) > Number(alone.normalRangeStart)) {
                          sub.judgement = '正常'
                        } else {
                          sub.judgement = '偏低'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏高'
                        } else {
                          sub.judgement = '正常'
                        }
                      }
                    })
                  }
                })
                itemType = 'other'
                domains = this.otherNameList
                // .filter((item, i) => {
                //   return item.value !== ''
                // })
                data = {
                  id: null,
                  userId: this.$store.getters.userId,
                  doctor: this.$store.getters.name,
                  department: this.$store.getters.deptment,
                  missionId: this.checkrowdata.dispatchId,
                  medicalId: this.checkrowdata.medicalId,
                  instanceType: editableTabsValue,
                  itemName: res.title,
                  itemType: itemType,
                  polarity: 0,
                  // json: JSON.stringify(jsonObj),
                  creatinine: '', // varchar(16) DEFAULT '' comment '肌酐',
                  creatinine_i: '', // varchar(16) DEFAULT '' comment '肌酐',
                  troponin: domains[0] ? domains[0].value ? domains[0].value : '' : '', // varchar(16) DEFAULT '' comment '肌钙蛋白',
                  troponin_i: domains[0] ? domains[0].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '肌钙蛋白',
                  hcy: domains[1] ? domains[1].value ? domains[1].value : '' : '', // varchar(16) DEFAULT '' comment '同型半胱氨酸',
                  hcy_i: domains[1] ? domains[1].judgement === '偏低' ? 'L' : domains[1].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '同型半胱氨酸',
                  excuteTime: res.request_tab_data.drawbloodTime,
                  reportTime: res.request_tab_data.reportTime,
                  remarks: res.request_tab_data.remarks,
                  version: 0,
                  status: 1
                }
              }
              // jsonObj.resultTime = res.request_tab_data.reportTime
              // jsonObj.bloodTime = res.request_tab_data.drawbloodTime
              // jsonObj.remarks = res.request_tab_data.remarks
              // jsonObj.orderDetail = domains
              // let data = {
              //   id: null,
              //   userId: this.$store.getters.userId,
              //   missionId: this.checkrowdata.dispatchId,
              //   medicalId: this.checkrowdata.medicalId,
              //   instanceType: editableTabsValue,
              //   itemName: res.title,
              //   itemType: itemType,
              //   polarity: 0,
              //   // json: JSON.stringify(jsonObj),
              //   bs: jsonObj.orderDetail[0].value,
              //   bs_u: jsonObj.orderDetail[0].unit,
              //   bs_i: jsonObj.orderDetail[0].judgement === '偏低' ? 'L' : jsonObj.orderDetail[0].judgement === '偏高' ? 'H' : '',
              //   excuteTime: jsonObj.bloodTime,
              //   reportTime: jsonObj.resultTime,
              //   version: 0,
              //   status: 1
              // }
              if (domains.length !== 0) {
                if (this.firstMedicalContactDateTime) {
                  if (new Date(this.firstMedicalContactDateTime).getTime() >= new Date(data.reportTime).getTime()) {
                    this.$message({
                      message: '抽血时间不能小于等于首次接诊医疗时间：' + this.firstMedicalContactDateTime,
                      type: 'warning'
                    })
                    return
                  }
                }

                if (new Date(data.excuteTime).getTime() >= new Date(data.reportTime).getTime()) {
                  this.$message({
                    message: '报告时间不能小于等于抽血时间',
                    type: 'warning'
                  })
                  return
                }
                console.log(1, data)
                if (editableTabsValue === 'strokeCoagulation') {
                  coagulation({
                    id: null,
                    userId: this.$store.getters.userId,
                    doctor: this.$store.getters.name,
                    department: this.$store.getters.deptment,
                    missionId: this.checkrowdata.dispatchId,
                    medicalId: this.checkrowdata.medicalId,
                    instanceType: editableTabsValue,
                    itemName: res.title,
                    itemType: itemType,
                    polarity: 0,
                    // json: JSON.stringify(jsonObj),
                    prothrombinTime: domains[0] ? domains[0].value ? domains[0].value : '' : '',
                    prothrombinTime_i: domains[0] ? domains[0].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '',
                    thromboplastin: domains[1] ? domains[1].value ? domains[1].value : '' : '',
                    thromboplastin_i: domains[1] ? domains[1].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '',
                    thrombinTime: domains[2] ? domains[2].value ? domains[2].value : '' : '',
                    thrombinTime_i: domains[2] ? domains[2].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '',
                    fibrinogen: domains[3] ? domains[3].value ? domains[3].value : '' : '',
                    fibrinogen_i: domains[3] ? domains[3].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '',
                    inr: domains[4] ? domains[4].value ? domains[4].value : '' : '',
                    inr_i: domains[4] ? domains[4].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '',
                    hasAudio: false,
                    excuteTime: res.request_tab_data.drawbloodTime,
                    reportTime: res.request_tab_data.reportTime,
                    remarks: res.request_tab_data.remarks,
                    version: 0,
                    status: 1
                  }).then(res => {
                    if (res.code === 0) {
                      this.$message({
                        message: '保存成功',
                        type: 'success'
                      })
                      this.newincalogase = false
                      this.editableTabs.forEach((item, index) => {
                        if (item.name === editableTabsValue) {
                          this.editableTabs[index].request_tab_data = {
                            drawbloodTime: '',
                            reportTime: '',
                            remarks: ''
                          }
                        }
                      });
                      this.bloodsugarNameList = JSON.parse(JSON.stringify(this.bloodsugarNameListcopy))
                      this.bloodfatNameList = JSON.parse(JSON.stringify(this.bloodfatNameListcopy))
                      this.CoagulationNameList = JSON.parse(JSON.stringify(this.CoagulationNameListcopy))
                      this.routinebloodNameList = JSON.parse(JSON.stringify(this.routinebloodNameListcopy))
                      this.renalelectrolyteNameList = JSON.parse(JSON.stringify(this.renalelectrolyteNameListcopy))
                      this.myocardialEnzymeNameList = JSON.parse(JSON.stringify(this.myocardialEnzymeNameListcopy))
                      this.otherNameList = this.otherNameListcopy
                      this.$refs[formName][0].resetFields()
                      this.getBloodDataStroke()
                    } else {
                      this.$message({
                        message: '保存失败',
                        type: 'error'
                      })
                    }
                  }).catch(err => {
                    console.log(err)
                  })
                } else if (editableTabsValue === 'strokeBoutineBloodTest') {
                  routineblood({
                    id: null,
                    userId: this.$store.getters.userId,
                    doctor: this.$store.getters.name,
                    department: this.$store.getters.deptment,
                    missionId: this.checkrowdata.dispatchId,
                    medicalId: this.checkrowdata.medicalId,
                    instanceType: editableTabsValue,
                    itemName: res.title,
                    itemType: itemType,
                    polarity: 0,
                    erythrocyteCount: domains[0].value, // '红细胞计数',
                    erythrocyteCount_i: domains[0].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '', // varchar(16) DEFAULT '' comment '红细胞计数',
                    redcell: domains[0].value, // varchar(16) DEFAULT '' comment '红细胞计数',
                    redcell_i: domains[0].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '', // varchar(16) DEFAULT '' comment '红细胞计数',
                    hemoglobin: domains[1].value, // '血红蛋白',
                    hemoglobin_i: domains[1].judgement === '偏低' ? 'L' : domains[1].judgement === '偏高' ? 'H' : '', // varchar(16) DEFAULT '' comment '血红蛋白',
                    leukocyte: domains[2].value, // '白细胞',
                    leukocyte_c: '', // '白细胞计数',
                    leukocyte_i: domains[2].judgement === '偏低' ? 'L' : domains[2].judgement === '偏高' ? 'H' : '', // varchar(16) DEFAULT '' comment '白细胞',
                    leukocyte_cc: domains[3].value, // '白细胞分类计数',
                    leukocyte_c_i: '', // varchar(16) DEFAULT '' comment '白细胞计数',
                    leukocyte_cc_i: domains[3].judgement === '偏低' ? 'L' : domains[3].judgement === '偏高' ? 'H' : '', // varchar(16) DEFAULT '' comment '白细胞分类计数',
                    plateletCount: domains[4].value, // '血小板计数',
                    plateletCount_i: domains[4].judgement === '偏低' ? 'L' : domains[4].judgement === '偏高' ? 'H' : '', // varchar(16) DEFAULT '' comment '血小板计数',
                    granulocyte: '', // varchar(16) DEFAULT '' comment '中性杆状核粒细胞',
                    granulocyte_1: '', // varchar(16) DEFAULT '' comment '中性杆状核粒细胞(x10/L)',
                    lobulated: '', // varchar(16) DEFAULT '' comment '中性分叶核粒细胞',
                    lobulated_1: '', // varchar(16) DEFAULT '' comment '中性分叶核粒细胞(x10/L)',
                    eosinophils: '', // varchar(16) DEFAULT '' comment '嗜酸粒细胞',
                    eosinophils_1: '', // varchar(16) DEFAULT '' comment '嗜酸粒细胞(x10/L)',
                    basophil: '', // varchar(16) DEFAULT '' comment '嗜碱粒细胞',
                    basophil_1: '', // varchar(16)  DEFAULT '' comment '嗜碱粒细胞(x10/L)',
                    lymphocyte: '', // varchar(16) DEFAULT '' comment '淋巴细胞',
                    lymphocyte_1: '', // varchar(16) DEFAULT '' comment '淋巴细胞(x10/L)',
                    monocyte: '', // varchar(16) DEFAULT '' comment '单核细胞',
                    monocyte_1: '', // varchar(16) DEFAULT '' comment '单核细胞(x10/L)',
                    granulocyte_i: '', // varchar(16) DEFAULT '' comment '中性杆状核粒细胞',
                    granulocyte_1_i: '', // varchar(16) DEFAULT '' comment '中性杆状核粒细胞(x10/L)',
                    lobulated_i: '', // varchar(16) DEFAULT '' comment '中性分叶核粒细胞',
                    lobulated_1_i: '', // varchar(16) DEFAULT '' comment '中性分叶核粒细胞(x10/L)',
                    eosinophils_i: '', // varchar(16) DEFAULT '' comment '嗜酸粒细胞',
                    eosinophils_1_i: '', // varchar(16) DEFAULT '' comment '嗜酸粒细胞(x10/L)',
                    basophil_i: '', // varchar(16) DEFAULT '' comment '嗜碱粒细胞',

                    // json: JSON.stringify(jsonObj),
                    hasAudio: false,
                    excuteTime: res.request_tab_data.drawbloodTime,
                    reportTime: res.request_tab_data.reportTime,
                    remarks: res.request_tab_data.remarks,
                    version: 0,
                    status: 1
                  }).then(res => {
                    if (res.code === 0) {
                      this.$message({
                        message: '保存成功',
                        type: 'success'
                      })
                      this.newincalogase = false
                      this.editableTabs.forEach((item, index) => {
                        if (item.name === editableTabsValue) {
                          this.editableTabs[index].request_tab_data = {
                            drawbloodTime: '',
                            reportTime: '',
                            remarks: ''
                          }
                        }
                      });
                      this.bloodsugarNameList = JSON.parse(JSON.stringify(this.bloodsugarNameListcopy))
                      this.bloodfatNameList = JSON.parse(JSON.stringify(this.bloodfatNameListcopy))
                      this.CoagulationNameList = JSON.parse(JSON.stringify(this.CoagulationNameListcopy))
                      this.routinebloodNameList = JSON.parse(JSON.stringify(this.routinebloodNameListcopy))
                      this.renalelectrolyteNameList = JSON.parse(JSON.stringify(this.renalelectrolyteNameListcopy))
                      this.myocardialEnzymeNameList = JSON.parse(JSON.stringify(this.myocardialEnzymeNameListcopy))
                      this.otherNameList = JSON.parse(JSON.stringify(this.otherNameListcopy))
                      this.$refs[formName][0].resetFields()
                      this.getBloodDataStroke()
                    } else {
                      this.$message({
                        message: '保存失败',
                        type: 'error'
                      })
                    }
                  }).catch(err => {
                    console.log(err)
                  })
                } else {
                  StrokeBloodnew(instance, data).then(res => {
                    if (res.code === 0) {
                      this.$message({
                        message: '保存成功',
                        type: 'success'
                      })
                      this.newincalogase = false
                      this.editableTabs.forEach((item, index) => {
                        if (item.name === editableTabsValue) {
                          this.editableTabs[index].request_tab_data = {
                            drawbloodTime: '',
                            reportTime: '',
                            remarks: ''
                          }
                        }
                      });
                      this.bloodsugarNameList = JSON.parse(JSON.stringify(this.bloodsugarNameListcopy))
                      this.bloodfatNameList = JSON.parse(JSON.stringify(this.bloodfatNameListcopy))
                      this.CoagulationNameList = JSON.parse(JSON.stringify(this.CoagulationNameListcopy))
                      this.routinebloodNameList = JSON.parse(JSON.stringify(this.routinebloodNameListcopy))
                      this.renalelectrolyteNameList = JSON.parse(JSON.stringify(this.renalelectrolyteNameListcopy))
                      this.myocardialEnzymeNameList = JSON.parse(JSON.stringify(this.myocardialEnzymeNameListcopy))
                      this.otherNameList = JSON.parse(JSON.stringify(this.otherNameListcopy))
                      this.$refs[formName][0].resetFields()
                      this.getBloodDataStroke()
                    } else {
                      this.$message({
                        message: '保存失败',
                        type: 'error'
                      })
                    }
                  }).catch(err => {
                    console.log(err)
                  })
                }
              } else {
                this.$message({
                  type: 'error',
                  message: '至少填写一项检测结果'
                })
              }
            }
          })
        }
      })
    },
    clickTab(tab) {
      this.editableTabs.forEach((res) => {
        if (res.name === tab.name) {
          res.show = true
        } else {
          res.show = false
        }
      })
    },
    rf(formName, editableTabsValue) {
      this.editableTabs.forEach((item, index) => {
        if (item.name === editableTabsValue) {
          this.editableTabs[index].request_tab_data = {
            drawbloodTime: '',
            reportTime: '',
            remarks: ''
          }
        }
      });
      if (editableTabsValue === 'strokeBloodsugar') {
        this.bloodsugarNameList = JSON.parse(JSON.stringify(this.bloodsugarNameListcopy))
      } else if (editableTabsValue === 'strokeFourItemsBloodLipid') {
        this.bloodfatNameList = JSON.parse(JSON.stringify(this.bloodfatNameListcopy))
      } else if (editableTabsValue === 'strokeCoagulation') {
        this.CoagulationNameList = JSON.parse(JSON.stringify(this.CoagulationNameListcopy))
      } else if (editableTabsValue === 'strokeBoutineBloodTest') {
        this.routinebloodNameList = JSON.parse(JSON.stringify(this.routinebloodNameListcopy))
      } else if (editableTabsValue === 'strokeRenalAndElectrolytes') {
        this.renalelectrolyteNameList = JSON.parse(JSON.stringify(this.renalelectrolyteNameListcopy))
      } else if (editableTabsValue === 'MyocardialEnzyme') {
        this.myocardialEnzymeNameList = JSON.parse(JSON.stringify(this.myocardialEnzymeNameListcopy))
      } else if (editableTabsValue === 'strokeOther') {
        this.otherNameList = JSON.parse(JSON.stringify(this.otherNameListcopy))
      }
      this.$refs[formName][0].resetFields()
    },
    getPatientInfo() {
      getPatientStroke(
        this.checkrowdata.patientId,
        this.checkrowdata.dispatchId
      ).then((res) => {
        // console.log(res)
        if (res.data) {
          this.firstMedicalContactDateTime =res.data.dispatchEmergens?res.data.dispatchEmergens.createdAt:""
        }
      })
    },
    /* 新增-------------------------- */
    popup() {
      this.newincalogase = true
    },
    // 新增关闭窗口
    handleClose(done) {
      this.$confirm('确认关闭？')
        .then(_ => {
          done()
        })
        .catch(_ => { })
    },

    // 获取正在使用的指标
    getAllOnUseTesttarget() {
      getAllOnUseTesttarget({ greenType: '卒中', hospitalId: this.$store.getters.hospitalId }).then((res) => {
        this.allOnUse = res.data
        const nameList = []
        this.allOnUse.forEach((item, index) => {
          // if (item.checkName === 'N-端脑利钠肽前体'){
          //   item.checkName = 'NT-proBNP'
          // }else
          // if(item.checkName === '国际标准化比值'){
          //   item.checkName = 'INR'
          // }
          // else if(item.checkName === '肌钙蛋白I'){
          //   this.maxRange = item.normalRangeEnd
          // }
        })
        this.allOnUse.forEach((item, index) => {
          if (item.projectName === '血糖') {
            this.bloodsugarNameList.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
            this.bloodsugarNameListcopy.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
          } else if (item.projectName === '血脂四项') {
            this.bloodfatNameList.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
            this.bloodfatNameListcopy.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
          } else if (item.projectName === '凝血功能') {
            this.CoagulationNameList.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
            this.CoagulationNameListcopy.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
          } else if (item.projectName === '血常规') {
            this.routinebloodNameList.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
            this.routinebloodNameListcopy.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
          } else if (item.projectName === '肾功能及电解质') {
            this.renalelectrolyteNameList.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
            this.renalelectrolyteNameListcopy.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
          } else if (item.projectName === '心肌酶') {
            this.myocardialEnzymeNameList.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
            this.myocardialEnzymeNameListcopy.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
          } else if (item.projectName === '其他') {
            this.otherNameList.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
            this.otherNameListcopy.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
          }
        })
      })
    },

    /* end---------------------------- */
    // 血液检查接口
    getBloodDataStroke() {
      let instance = ''
      const dispatch = this.checkrowdata.dispatchId
      this.strokeBloodsugarList = []
      this.strokeFourItemsBloodLipidList = []
      this.strokeCoagulationList = []
      this.strokeBoutineBloodTestList = []
      this.strokeRenalAndElectrolytesList = []
      this.strokeMyocardialEnzymeList = []
      this.strokeOtherList = []
      for (const typeIndex in this.instanceTypeList) {
        instance = this.instanceTypeList[typeIndex]
        if (this.instanceTypeList[typeIndex] === 'strokeBloodsugar') {
          queryBloodDataStroke({
            instance: instance,
            dispatchId: dispatch
          }).then(res => {
            for (const item in res.data.chipsOrder) {
              res.data.chipsOrder[item].json = JSON.parse(res.data.chipsOrder[item].json)
              this.strokeBloodsugarList.push(res.data.chipsOrder[item])
            }
          }).catch(err => {
            console.log(err)
          })
        } else if (this.instanceTypeList[typeIndex] === 'strokeFourItemsBloodLipid') {
          queryBloodDataStroke({
            instance: instance,
            dispatchId: dispatch
          }).then(res => {
            for (const item in res.data.chipsOrder) {
              res.data.chipsOrder[item].json = JSON.parse(res.data.chipsOrder[item].json)
              this.strokeFourItemsBloodLipidList.push(res.data.chipsOrder[item])
            }
          }).catch(err => {
            console.log(err)
          })
        } else if (this.instanceTypeList[typeIndex] === 'strokeCoagulation') {
          queryBloodDataStroke({
            instance: instance,
            dispatchId: dispatch
          }).then(res => {
            for (const item in res.data.chipsOrder) {
              res.data.chipsOrder[item].json = JSON.parse(res.data.chipsOrder[item].json)
              this.strokeCoagulationList.push(res.data.chipsOrder[item])
            }
          }).catch(err => {
            console.log(err)
          })
        } else if (this.instanceTypeList[typeIndex] === 'strokeBoutineBloodTest') {
          queryBloodDataStroke({
            instance: instance,
            dispatchId: dispatch
          }).then(res => {
            for (const item in res.data.chipsOrder) {
              res.data.chipsOrder[item].json = JSON.parse(res.data.chipsOrder[item].json)
              this.strokeBoutineBloodTestList.push(res.data.chipsOrder[item])
            }
            console.log("this.strokeBoutineBloodTestList",this.strokeBoutineBloodTestList)
          }).catch(err => {
            console.log(err)
          })
        } else if (this.instanceTypeList[typeIndex] === 'strokeRenalAndElectrolytes') {
          queryBloodDataStroke({
            instance: instance,
            dispatchId: dispatch
          }).then(res => {
            for (const item in res.data.chipsOrder) {
              res.data.chipsOrder[item].json = JSON.parse(res.data.chipsOrder[item].json)
              this.strokeRenalAndElectrolytesList.push(res.data.chipsOrder[item])
            }
          }).catch(err => {
            console.log(err)
          })
        } else if (this.instanceTypeList[typeIndex] === 'strokeBioChemistry') {
          queryBloodDataStroke({
            instance: instance,
            dispatchId: dispatch
          }).then(res => {
            for (const item in res.data.chipsOrder) {
              res.data.chipsOrder[item].json = JSON.parse(res.data.chipsOrder[item].json)
              this.strokeOtherList.push(res.data.chipsOrder[item])
            }
          }).catch(err => {
            console.log(err)
          })
        } else if (this.instanceTypeList[typeIndex] === 'MyocardialEnzyme') {
          queryBloodDataStroke({
            instance: instance,
            dispatchId: dispatch
          }).then(res => {
            if (res.data) {
              for (const item in res.data.chipsOrder) {
                res.data.chipsOrder[item].json = JSON.parse(res.data.chipsOrder[item].json)
                this.strokeMyocardialEnzymeList.push(res.data.chipsOrder[item])
              }
            }
          })
        }
      }
    },

    // 血糖趋势图
    goViewMyocardialenzymes() {
      const createdMyTime = []
      const myValue = []
      let abbrArr = []
      // 定义已知数据全量集
      const optionAll = {
        '血糖': [],
        '糖化血红蛋白': []
      }
      // 深拷贝数据避免影响页面数据
      const parestData = JSON.parse(JSON.stringify(this.strokeBloodsugarList))
      parestData.forEach((el, index) => {
        console.log(el, 'el')
        // 做x时间轴数据
        createdMyTime.push(el.reportTime)
        // 补全缺失信息
        // 根据全集补全缺失数据，避免折线图数据缺失
        Object.keys(optionAll).forEach(item => {
          // 判断已有数据是否存在全量5项
          const exist = el.json.orderDetail.some(res => {
            if (!res.value) {
              res.value = 0
            }
            return res.abbr === item
          })
          // 如缺失，则补齐abbr，value项 供生成折线图使用
          if (!exist) {
            el.json.orderDetail.push({
              abbr: item,
              value: 0
            })
          }
        })
        // 循环已有数据，值放入optionAll内，以供生成折线图
        el.json.orderDetail.forEach((item, key) => {
          if (optionAll[item.abbr]) optionAll[item.abbr].push(item.value)
        })
      })
      Object.keys(optionAll).forEach(item => {
        myValue.push({
          name: item,
          data: optionAll[item],
          type: 'line'
        })
      })
      abbrArr = ['血糖', '糖化血红蛋白']
      createdMyTime.reverse()
      this.dialogVisible = true
      this.$nextTick(function () {
        this.drawLineMyocardialenzymes(createdMyTime, myValue, abbrArr)
      })
    },
    drawLineMyocardialenzymes(createdMyTime, myValue, abbrArr) {
      const chart = this.$refs.chart
      const trendList = {
        // title: {
        //   text: '血糖'
        // },
        tooltip: {
          trigger: 'item',
          formatter: ' {b} <br /> {a} :{c}'
        },
        legend: {
          top: 0,
          left: 'center',
          data: abbrArr
        },
        xAxis: {
          type: 'category',
          data: createdMyTime
        },
        yAxis: {
          type: 'value'
        },
        dataZoom: [{
          type: 'inside'
        }],
        series: myValue
      }
      if (chart) {
        const myChart = echarts.init(chart)
        myChart.setOption(trendList)
      }
    },
    // 血脂四项趋势图
    goViewFourItemsBloodCoagulation() {
      const createdMyTime = []
      const myValue = []
      let abbrArr = []
      // 定义已知数据全量集
      const optionAll = {
        '甘油三酯': [],
        '总胆固醇': [],
        '低密度脂蛋白': [],
        '高密度脂蛋白': []
      }
      // 深拷贝数据避免影响页面数据
      const parestData = JSON.parse(JSON.stringify(this.strokeFourItemsBloodLipidList))
      parestData.forEach((el, index) => {
        // 做x时间轴数据
        createdMyTime.push(el.reportTime)
        // 补全缺失信息
        // 根据全集补全缺失数据，避免折线图数据缺失
        Object.keys(optionAll).forEach(item => {
          // 判断已有数据是否存在全量5项
          const exist = el.json.orderDetail.some((res) => {
            if (!res.value) {
              res.value = 0
            }
            return res.abbr === item
          })
          // 如缺失，则补齐abbr，value项 供生成折线图使用
          if (!exist) {
            el.json.orderDetail.push({
              abbr: item,
              value: 0
            })
          }
        })
        // 循环已有数据，值放入optionAll内，以供生成折线图
        el.json.orderDetail.forEach((item, key) => {
          if (optionAll[item.abbr]) optionAll[item.abbr].push(item.value)
        })
      })
      Object.keys(optionAll).forEach(item => {
        myValue.push({
          name: item,
          data: optionAll[item],
          type: 'line'
        })
      })
      abbrArr = ['甘油三酯', '总胆固醇', '低密度脂蛋白', '高密度脂蛋白']
      createdMyTime.reverse()
      this.dialogVisible = true
      this.$nextTick(function () {
        this.drawLineFourItemsBloodCoagulation(createdMyTime, myValue, abbrArr)
      })
    },
    drawLineFourItemsBloodCoagulation(createdMyTime1, myValue1, abbrArr1) {
      const chart = this.$refs.chart
      const trendList = {
        // title: {
        //   text: '血脂四项'
        // },
        tooltip: {
          trigger: 'item',
          formatter: ' {b} <br /> {a} :{c}'
        },
        legend: {
          top: 0,
          left: 'center',
          data: abbrArr1
        },
        xAxis: {
          type: 'category',
          data: createdMyTime1
        },
        yAxis: {
          type: 'value'
        },
        dataZoom: [{
          type: 'inside'
        }],
        series: myValue1
      }
      if (chart) {
        const myChart = echarts.init(chart)
        myChart.setOption(trendList)
      }
    },

    // 凝血功能趋势图
    goViewbloodRoutineExamination() {
      const createdMyTime = []
      const myValue = []
      let abbrArr = []
      // 定义已知数据全量集
      const optionAll = {
        '凝血酶原时间': [],
        '活化部分凝血活酶': [],
        '凝血酶时间': [],
        '纤维蛋白原': [],
        '国际标准化比值': []
      }
      // 深拷贝数据避免影响页面数据
      const parestData = JSON.parse(JSON.stringify(this.strokeCoagulationList))
      parestData.forEach((el, index) => {
        // 做x时间轴数据
        createdMyTime.push(el.reportTime)
        // 补全缺失信息
        // 根据全集补全缺失数据，避免折线图数据缺失
        Object.keys(optionAll).forEach(item => {
          // 判断已有数据是否存在全量5项
          const exist = el.json.orderDetail.some((res) => {
            if (!res.value) {
              res.value = 0
            }
            return res.abbr === item
          })
          // 如缺失，则补齐abbr，value项 供生成折线图使用
          if (!exist) {
            el.json.orderDetail.push({
              abbr: item,
              value: 0
            })
          }
        })
        // 循环已有数据，值放入optionAll内，以供生成折线图
        el.json.orderDetail.forEach((item, key) => {
          if (optionAll[item.abbr]) optionAll[item.abbr].push(item.value)
        })
      })
      Object.keys(optionAll).forEach(item => {
        myValue.push({
          name: item,
          data: optionAll[item],
          type: 'line'
        })
      })
      abbrArr = ['凝血酶原时间', '活化部分凝血活酶', '凝血酶时间', '纤维蛋白原', '国际标准化比值']
      createdMyTime.reverse()
      this.dialogVisible = true
      this.$nextTick(function () {
        this.drawLinebloodRoutineExamination(createdMyTime, myValue, abbrArr)
      })
    },
    drawLinebloodRoutineExamination(createdMyTime, myValue, abbrArr) {
      const chart = this.$refs.chart
      const trendList = {
        // title: {
        //   text: '凝血功能'
        // },
        tooltip: {
          trigger: 'item',
          formatter: ' {b} <br /> {a} :{c}'
        },
        legend: {
          top: -5,
          left: '80px',
          data: abbrArr
        },
        xAxis: {
          type: 'category',
          data: createdMyTime
        },
        yAxis: {
          type: 'value'
        },
        dataZoom: [{
          type: 'inside'
        }],
        series: myValue
      }
      if (chart) {
        const myChart = echarts.init(chart)
        myChart.setOption(trendList)
      }
    },

    // 血常规趋势图
    goViewSerumCreatinine() {
      const createdMyTime = []
      const myValue = []
      let abbrArr = []
      // 定义已知数据全量集
      const optionAll = {
        '红细胞计数': [],
        '血红蛋白': [],
        '白细胞': [],
        '白细胞分类计数': [],
        '血小板计数': []
      }
      // 深拷贝数据避免影响页面数据
      const parestData = JSON.parse(JSON.stringify(this.strokeBoutineBloodTestList))
      parestData.forEach((el, index) => {
        // 做x时间轴数据
        createdMyTime.push(el.reportTime)
        // 补全缺失信息
        // 根据全集补全缺失数据，避免折线图数据缺失
        Object.keys(optionAll).forEach(item => {
          // 判断已有数据是否存在全量5项
          const exist = el.json.orderDetail.some((res) => {
            return res.abbr === item
          })
          // 如缺失，则补齐abbr，value项 供生成折线图使用
          if (!exist) {
            el.json.orderDetail.push({
              abbr: item,
              value: ''
            })
          }
        })
        // 循环已有数据，值放入optionAll内，以供生成折线图
        el.json.orderDetail.forEach((item, key) => {
          if (optionAll[item.abbr]) {
            optionAll[item.abbr].push(item.value)
          }
        })
      })
      Object.keys(optionAll).forEach(item => {
        myValue.push({
          name: item,
          data: optionAll[item],
          type: 'line'
        })
      })
      abbrArr = [
        '红细胞计数',
        '血红蛋白',
        '白细胞',
        '白细胞分类计数',
        '血小板计数']
      createdMyTime.reverse()
      this.dialogVisible = true
      this.$nextTick(function () {
        this.drawLineSerumCreatinine(createdMyTime, myValue, abbrArr)
      })
    },
    drawLineSerumCreatinine(createdMyTime, myValue, abbrArr) {
      const chart = this.$refs.chart
      const trendList = {
        // title: {
        //   text: '血常规'
        // },
        tooltip: {
          trigger: 'item',
          formatter: ' {b} <br /> {a} :{c}'
        },
        legend: {
          top: 0,
          left: 'center',
          data: abbrArr
        },
        xAxis: {
          type: 'category',
          data: createdMyTime
        },
        yAxis: {
          type: 'value'
        },
        dataZoom: [{
          type: 'inside'
        }],
        series: myValue
      }
      if (chart) {
        const myChart = echarts.init(chart)
        myChart.setOption(trendList)
      }
    },

    // 肾功能及电解质
    goViewRenalAndElectrolytes() {
      const createdMyTime = []
      const myValue = []
      let abbrArr = []
      // 定义已知数据全量集
      const optionAll = {
        '血清肌酐': [],
        '血清尿素氮': [],
        '尿酸': [],
        '钾': [],
        '钠': [],
        '氯': [],
        '钙': [],
        '无机磷': [],
        '镁': []
      }
      // 深拷贝数据避免影响页面数据
      const parestData = JSON.parse(JSON.stringify(this.strokeRenalAndElectrolytesList))
      parestData.forEach((el, index) => {
        // 做x时间轴数据
        createdMyTime.push(el.reportTime)
        // 补全缺失信息
        // 根据全集补全缺失数据，避免折线图数据缺失
        Object.keys(optionAll).forEach(item => {
          // 判断已有数据是否存在全量5项
          const exist = el.json.orderDetail.some((res) => {
            if (!res.value) {
              res.value = 0
            }
            return res.abbr === item
          })
          // 如缺失，则补齐abbr，value项 供生成折线图使用
          if (!exist) {
            el.json.orderDetail.push({
              abbr: item,
              value: 0
            })
          }
        })
        // 循环已有数据，值放入optionAll内，以供生成折线图
        el.json.orderDetail.forEach((item, key) => {
          if (optionAll[item.abbr]) optionAll[item.abbr].push(item.value)
        })
      })
      Object.keys(optionAll).forEach(item => {
        myValue.push({
          name: item,
          data: optionAll[item],
          type: 'line'
        })
      })
      abbrArr = ['血清肌酐', '血清尿素氮', '尿酸', '钾', '钠', '氯', '钙', '无机磷', '镁']
      createdMyTime.reverse()
      this.dialogVisible = true
      this.$nextTick(function () {
        this.drawLineRenalAndElectrolytes(createdMyTime, myValue, abbrArr)
      })
    },
    drawLineRenalAndElectrolytes(createdMyTime, myValue, abbrArr) {
      const chart = this.$refs.chart
      const trendList = {
        // title: {
        //   text: '肾功能及电解质'
        // },
        tooltip: {
          trigger: 'item',
          formatter: ' {b} <br /> {a} :{c}'
        },
        legend: {
          top: 0,
          left: 'center',
          data: abbrArr
        },
        xAxis: {
          type: 'category',
          data: createdMyTime
        },
        yAxis: {
          type: 'value'
        },
        dataZoom: [{
          type: 'inside'
        }],
        series: myValue
      }
      if (chart) {
        const myChart = echarts.init(chart)
        myChart.setOption(trendList)
      }
    },
    // 心肌酶趋势图
    goViewstrokeMyocardialEnzyme() {
      const createdMyTime = []
      const myValue = []
      let abbrArr = []
      const optionAll = {
        '肌酸激酶': [],
        '羟基丁酸脱氢酶': [],
        '肌酸激酶同工酶': [],
        '乳酸脱氢酶': []
      }
      // 深拷贝数据避免影响页面数据
      const parestData = JSON.parse(JSON.stringify(this.strokeMyocardialEnzymeList))
      parestData.forEach((el, index) => {
        // 做x时间轴数据
        createdMyTime.push(el.reportTime)
        // 补全缺失信息
        // 根据全集补全缺失数据，避免折线图数据缺失
        Object.keys(optionAll).forEach(item => {
          // 判断已有数据是否存在全量5项
          const exist = el.json.orderDetail.some((res) => {
            if (!res.value) {
              res.value = 0
            }
            return res.abbr === item
          })
          // 如缺失，则补齐abbr，value项 供生成折线图使用
          if (!exist) {
            el.json.orderDetail.push({
              abbr: item,
              value: 0
            })
          }
        })
        // 循环已有数据，值放入optionAll内，以供生成折线图
        el.json.orderDetail.forEach((item, key) => {
          if (optionAll[item.abbr]) optionAll[item.abbr].push(item.value)
        })
      })
      Object.keys(optionAll).forEach(item => {
        myValue.push({
          name: item,
          data: optionAll[item],
          type: 'line'
        })
      })
      abbrArr = ['肌酸激酶', '羟基丁酸脱氢酶', '肌酸激酶同工酶', '乳酸脱氢酶']
      createdMyTime.reverse()
      this.dialogVisible = true
      this.$nextTick(function () {
        this.drawLineMyocardialEnzyme(createdMyTime, myValue, abbrArr)
      })
    },
    drawLineMyocardialEnzyme(createdMyTime, myValue, abbrArr) {
      const chart = this.$refs.chart
      const trendList = {
        // title: {
        //   text: '其他'
        // },
        tooltip: {
          trigger: 'item',
          formatter: ' {b} <br /> {a} :{c}'
        },
        legend: {
          top: 0,
          left: 'center',
          data: abbrArr
        },
        xAxis: {
          type: 'category',
          data: createdMyTime
        },
        yAxis: {
          type: 'value'
        },
        dataZoom: [{
          type: 'inside'
        }],
        series: myValue
      }
      if (chart) {
        const myChart = echarts.init(chart)
        myChart.setOption(trendList)
      }
    },
    // 其他趋势图
    goViewstrokeOther() {
      const createdMyTime = []
      const myValue = []
      let abbrArr = []
      // 定义已知数据全量集
      const optionAll = {
        '肌钙蛋白': [],
        '同型半胱氨酸': []
      }
      // 深拷贝数据避免影响页面数据
      const parestData = JSON.parse(JSON.stringify(this.strokeOtherList))
      parestData.forEach((el, index) => {
        // 做x时间轴数据
        createdMyTime.push(el.reportTime)
        // 补全缺失信息
        // 根据全集补全缺失数据，避免折线图数据缺失
        Object.keys(optionAll).forEach(item => {
          // 判断已有数据是否存在全量5项
          const exist = el.json.orderDetail.some((res) => {
            if (!res.value) {
              res.value = 0
            }
            return res.abbr === item
          })
          // 如缺失，则补齐abbr，value项 供生成折线图使用
          if (!exist) {
            el.json.orderDetail.push({
              abbr: item,
              value: 0
            })
          }
        })
        // 循环已有数据，值放入optionAll内，以供生成折线图
        el.json.orderDetail.forEach((item, key) => {
          if (optionAll[item.abbr]) optionAll[item.abbr].push(item.value)
        })
      })
      Object.keys(optionAll).forEach(item => {
        myValue.push({
          name: item,
          data: optionAll[item],
          type: 'line'
        })
      })
      abbrArr = ['肌钙蛋白', '同型半胱氨酸']
      createdMyTime.reverse()
      this.dialogVisible = true
      this.$nextTick(function () {
        this.drawLinestrokeOther(createdMyTime, myValue, abbrArr)
      })
    },
    drawLinestrokeOther(createdMyTime, myValue, abbrArr) {
      const chart = this.$refs.chart
      const trendList = {
        // title: {
        //   text: '其他'
        // },
        tooltip: {
          trigger: 'item',
          formatter: ' {b} <br /> {a} :{c}'
        },
        legend: {
          top: 0,
          left: 'center',
          data: abbrArr
        },
        xAxis: {
          type: 'category',
          data: createdMyTime
        },
        yAxis: {
          type: 'value'
        },
        dataZoom: [{
          type: 'inside'
        }],
        series: myValue
      }
      if (chart) {
        const myChart = echarts.init(chart)
        myChart.setOption(trendList)
      }
    },

    // 保存
    saveMyocardialenzymes(type, index, remark_vlaue) {
      console.log(type, index, remark_vlaue)
      const newindex = index
      let instance = ''
      let data = {}
      if (type === 'bloodsugar') {
        instance = 'bloodsugar'
        this.strokeBloodsugarList.forEach((res, index) => {
          if (index === newindex) {
            res.json.orderDetail.forEach(sub => {
              if (sub.value !== '') {
                this.allOnUse.forEach(alone => {
                  if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                    if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                      sub.judgement = '偏高'
                    } else if (Number(sub.value) < Number(alone.normalRangeStart)) {
                      sub.judgement = '偏低'
                    } else {
                      sub.judgement = '正常'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                    if (Number(sub.value) > Number(alone.normalRangeStart)) {
                      sub.judgement = '正常'
                    } else {
                      sub.judgement = '偏低'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                    if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                      sub.judgement = '偏高'
                    } else {
                      sub.judgement = '正常'
                    }
                  }
                })
              }
            })
            data = {
              id: res.id,
              userId: res.userId,
              missionId: res.missionId,
              medicalId: res.medicalId,
              instanceType: res.instanceType,
              itemName: res.itemName,
              excuteTime: res.json.bloodTime ? res.json.bloodTime : '',
              reportTime: res.json.resultTime ? res.json.resultTime : '',
              bloodTime: res.json.bloodTime ? res.json.bloodTime : '',
              resultTime: res.json.resultTime ? res.json.resultTime : '',
              itemType: type,
              polarity: res.polarity,
              bs: res.json.orderDetail.filter(item => { return item.abbr == '血糖' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '血糖' })[0].value : '',
              bs_u: res.json.orderDetail.filter(item => { return item.abbr == '血糖' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '血糖' })[0].unit : '',
              bs_i: res.json.orderDetail.filter(item => { return item.abbr == '血糖' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '血糖' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '血糖' })[0].judgement === '偏高' ? 'H' : '' : '',
              hba1c: res.json.orderDetail.filter(item => { return item.abbr == '糖化血红蛋白' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '糖化血红蛋白' })[0].value : '',
              hba1c_u: res.json.orderDetail.filter(item => { return item.abbr == '糖化血红蛋白' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '糖化血红蛋白' })[0].unit : '',
              hba1c_i: res.json.orderDetail.filter(item => { return item.abbr == '糖化血红蛋白' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '糖化血红蛋白' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '糖化血红蛋白' })[0].judgement === '偏高' ? 'H' : '' : '',
              version: res.version,
              status: res.status,
              judgement: res.judgement,
              hasAudio: res.hasAudio,
              hasPhoto: res.hasPhoto,
              remarks: remark_vlaue
            }
          }
        })
      } else if (type === 'fourItemsBloodLipidmission') {
        instance = 'bloodlipid'
        this.strokeFourItemsBloodLipidList.forEach((res, index) => {
          if (index === newindex) {
            res.json.orderDetail.forEach(sub => {
              if (sub.value !== '') {
                this.allOnUse.forEach(alone => {
                  if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                    if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                      sub.judgement = '偏高'
                    } else if (Number(sub.value) < Number(alone.normalRangeStart)) {
                      sub.judgement = '偏低'
                    } else {
                      sub.judgement = '正常'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                    if (Number(sub.value) > Number(alone.normalRangeStart)) {
                      sub.judgement = '正常'
                    } else {
                      sub.judgement = '偏低'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                    if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                      sub.judgement = '偏高'
                    } else {
                      sub.judgement = '正常'
                    }
                  }
                })
              }
            })
            data = {
              id: res.id,
              userId: res.userId,
              missionId: res.missionId,
              medicalId: res.medicalId,
              instanceType: res.instanceType,
              itemName: res.itemName,
              excuteTime: res.json.bloodTime ? res.json.bloodTime : '',
              reportTime: res.json.resultTime ? res.json.resultTime : '',
              bloodTime: res.json.bloodTime ? res.json.bloodTime : '',
              resultTime: res.json.resultTime ? res.json.resultTime : '',
              itemType: type,
              polarity: res.polarity,
              chol: res.json.orderDetail.filter(item => { return item.abbr == '总胆固醇' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '总胆固醇' })[0].value : '',
              chol_u: res.json.orderDetail.filter(item => { return item.abbr == '总胆固醇' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '总胆固醇' })[0].unit : '',
              chol_i: res.json.orderDetail.filter(item => { return item.abbr == '总胆固醇' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '总胆固醇' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '总胆固醇' })[0].judgement === '偏高' ? 'H' : '' : '',
              hdl: res.json.orderDetail.filter(item => { return item.abbr == '高密度脂蛋白' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '高密度脂蛋白' })[0].value : '',
              hdl_u: res.json.orderDetail.filter(item => { return item.abbr == '高密度脂蛋白' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '高密度脂蛋白' })[0].unit : '',
              hdl_i: res.json.orderDetail.filter(item => { return item.abbr == '高密度脂蛋白' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '高密度脂蛋白' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '高密度脂蛋白' })[0].judgement === '偏高' ? 'H' : '' : '',
              trig: res.json.orderDetail.filter(item => { return item.abbr == '甘油三酯' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '甘油三酯' })[0].value : '',
              trig_u: res.json.orderDetail.filter(item => { return item.abbr == '甘油三酯' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '甘油三酯' })[0].unit : '',
              trig_i: res.json.orderDetail.filter(item => { return item.abbr == '甘油三酯' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '甘油三酯' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '甘油三酯' })[0].judgement === '偏高' ? 'H' : '' : '',
              ldl: res.json.orderDetail.filter(item => { return item.abbr == '低密度脂蛋白' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '低密度脂蛋白' })[0].value : '',
              ldl_u: res.json.orderDetail.filter(item => { return item.abbr == '低密度脂蛋白' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '低密度脂蛋白' })[0].unit : '',
              ldl_i: res.json.orderDetail.filter(item => { return item.abbr == '低密度脂蛋白' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '低密度脂蛋白' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '低密度脂蛋白' })[0].judgement === '偏高' ? 'H' : '' : '',
              version: res.version,
              status: res.status,
              judgement: res.judgement,
              hasAudio: res.hasAudio,
              hasPhoto: res.hasPhoto,
              remarks: remark_vlaue
            }
          }
        })
      } else if (type === 'coagulation') {
        instance = 'coagulation'
        this.strokeCoagulationList.forEach((res, index) => {
          if (index === newindex) {
            res.json.orderDetail.forEach(sub => {
              if (sub.value !== '') {
                this.allOnUse.forEach(alone => {
                  if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                    if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                      sub.judgement = '偏高'
                    } else if (Number(sub.value) < Number(alone.normalRangeStart)) {
                      sub.judgement = '偏低'
                    } else {
                      sub.judgement = '正常'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                    if (Number(sub.value) > Number(alone.normalRangeStart)) {
                      sub.judgement = '正常'
                    } else {
                      sub.judgement = '偏低'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                    if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                      sub.judgement = '偏高'
                    } else {
                      sub.judgement = '正常'
                    }
                  }
                })
              }
            })
            data = {
              id: res.id,
              userId: res.userId,
              missionId: res.missionId,
              medicalId: res.medicalId,
              instanceType: res.instanceType,
              itemName: res.itemName,
              excuteTime: res.json.bloodTime ? res.json.bloodTime : '',
              reportTime: res.json.resultTime ? res.json.resultTime : '',
              bloodTime: res.json.bloodTime ? res.json.bloodTime : '',
              resultTime: res.json.resultTime ? res.json.resultTime : '',
              itemType: type,
              polarity: res.polarity,
              prothrombinTime: res.json.orderDetail.filter(item => { return item.abbr == '凝血酶原时间' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '凝血酶原时间' })[0].value : '',
              prothrombinTime_i: res.json.orderDetail.filter(item => { return item.abbr == '凝血酶原时间' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '凝血酶原时间' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '凝血酶原时间' })[0].judgement === '偏高' ? 'H' : '' : '',
              thromboplastin: res.json.orderDetail.filter(item => { return item.abbr == '活化部分凝血活酶' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '活化部分凝血活酶' })[0].value : '',
              thromboplastin_i: res.json.orderDetail.filter(item => { return item.abbr == '活化部分凝血活酶' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '活化部分凝血活酶' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '活化部分凝血活酶' })[0].judgement === '偏高' ? 'H' : '' : '',
              thrombinTime: res.json.orderDetail.filter(item => { return item.abbr == '凝血酶时间' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '凝血酶时间' })[0].value : '',
              thrombinTime_i: res.json.orderDetail.filter(item => { return item.abbr == '凝血酶时间' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '凝血酶时间' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '凝血酶时间' })[0].judgement === '偏高' ? 'H' : '' : '',
              fibrinogen: res.json.orderDetail.filter(item => { return item.abbr == '纤维蛋白原' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '纤维蛋白原' })[0].value : '',
              fibrinogen_i: res.json.orderDetail.filter(item => { return item.abbr == '纤维蛋白原' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '纤维蛋白原' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '纤维蛋白原' })[0].judgement === '偏高' ? 'H' : '' : '',
              inr: res.json.orderDetail.filter(item => { return item.abbr == '国际标准化比值' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '国际标准化比值' })[0].value : '',
              inr_i: res.json.orderDetail.filter(item => { return item.abbr == '国际标准化比值' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '国际标准化比值' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '国际标准化比值' })[0].judgement === '偏高' ? 'H' : '' : '',
              version: res.version,
              status: res.status,
              judgement: res.judgement,
              hasAudio: res.hasAudio,
              hasPhoto: res.hasPhoto,
              remarks: remark_vlaue
            }
          }
        })
        coagulation(data).then(res => {
          if (res.code === 0) {
            this.$message({
              message: '保存成功',
              type: 'success'
            })
            this.getBloodDataStroke()
          } else {
            this.$message({
              message: '保存失败',
              type: 'error'
            })
          }
        }).catch(err => {
          console.log(err)
        })
      } else if (type === 'boutineBloodTest') {
        instance = 'routineblood'
        this.strokeBoutineBloodTestList.forEach((res, index) => {
          if (index === newindex) {
            res.json.orderDetail.forEach(sub => {
              if (sub.value !== '') {
                this.allOnUse.forEach(alone => {
                  if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                    if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                      sub.judgement = '偏高'
                    } else if (Number(sub.value) < Number(alone.normalRangeStart)) {
                      sub.judgement = '偏低'
                    } else {
                      sub.judgement = '正常'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                    if (Number(sub.value) > Number(alone.normalRangeStart)) {
                      sub.judgement = '正常'
                    } else {
                      sub.judgement = '偏低'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                    if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                      sub.judgement = '偏高'
                    } else {
                      sub.judgement = '正常'
                    }
                  }
                })
              }
            })
            data = {
              id: res.id,
              excuteTime: res.json.bloodTime ? res.json.bloodTime : '',
              reportTime: res.json.resultTime ? res.json.resultTime : '',
              bloodTime: res.json.bloodTime ? res.json.bloodTime : '',
              resultTime: res.json.resultTime ? res.json.resultTime : '',
              instanceType: res.instanceType,
              itemName: res.itemName,
              itemType: type,
              hasAudio: res.hasAudio,
              basophil: '',
              basophil_1: '',
              basophil_i: '',
              eosinophils: '',
              eosinophils_1: '',
              eosinophils_1_i: '',
              eosinophils_i: '',
              erythrocyteCount: res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' })[0].value : '',
              erythrocyteCount_i: res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' })[0].judgement === '偏高' ? 'H' : '' : '',
              granulocyte: '',
              granulocyte_1: '',
              granulocyte_1_i: '',
              granulocyte_i: '',
              hemoglobin: res.json.orderDetail.filter(item => { return item.abbr == '血红蛋白' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '血红蛋白' })[0].value : '',
              hemoglobin_i: res.json.orderDetail.filter(item => { return item.abbr == '血红蛋白' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '血红蛋白' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '血红蛋白' })[0].judgement === '偏高' ? 'H' : '' : '',
              leukocyte: res.json.orderDetail.filter(item => { return item.abbr == '白细胞' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '白细胞' })[0].value : '',
              leukocyte_i: res.json.orderDetail.filter(item => { return item.abbr == '白细胞' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '白细胞' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '白细胞' })[0].judgement === '偏高' ? 'H' : '' : '',
              leukocyte_c: '',
              leukocyte_c_i: '',
              leukocyte_cc: res.json.orderDetail.filter(item => { return item.abbr == '白细胞分类计数' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '白细胞分类计数' })[0].value : '',
              leukocyte_cc_i: res.json.orderDetail.filter(item => { return item.abbr == '白细胞分类计数' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '白细胞分类计数' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '白细胞分类计数' })[0].judgement === '偏高' ? 'H' : '' : '',
              lobulated: '',
              lobulated_1: '',
              lobulated_1_i: '',
              lobulated_i: '',
              lymphocyte: '',
              lymphocyte_1: '',
              monocyte: '',
              monocyte_1: '',
              plateletCount: res.json.orderDetail.filter(item => { return item.abbr == '血小板计数' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '血小板计数' })[0].value : '',
              plateletCount_i: res.json.orderDetail.filter(item => { return item.abbr == '血小板计数' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '血小板计数' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '血小板计数' })[0].judgement === '偏高' ? 'H' : '' : '',
              redcell: res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' })[0].value : '',
              redcell_i: res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' })[0].judgement === '偏高' ? 'H' : '' : '',
              medicalId: res.medicalId,
              missionId: res.missionId,
              polarity: res.polarity,
              remarks: remark_vlaue,
              status: res.status,
              judgement: res.judgement,
              userId: res.userId,
              version: res.version

              // id: res.id,
              // userId: res.userId,
              // missionId: res.missionId,
              // medicalId: res.medicalId,
              // instanceType: res.instanceType,
              // itemName: res.itemName,
              // itemType: type,
              // polarity: res.polarity,
              // prothrombinTime: JSON.parse(res.json).orderDetail[0].value,
              // prothrombinTime_i: JSON.parse(res.json).orderDetail[0].judgement === '偏低' ? 'L' : JSON.parse(res.json).orderDetail[0].judgement === '偏高' ? 'H' : '',
              // thromboplastin: JSON.parse(res.json).orderDetail[1].value,
              // thromboplastin_i: JSON.parse(res.json).orderDetail[1].judgement === '偏低' ? 'L' : JSON.parse(res.json).orderDetail[0].judgement === '偏高' ? 'H' : '',
              // thrombinTime_i: JSON.parse(res.json).orderDetail[2].value,
              // thrombinTime: JSON.parse(res.json).orderDetail[2].judgement === '偏低' ? 'L' : JSON.parse(res.json).orderDetail[0].judgement === '偏高' ? 'H' : '',
              // fibrinogen: JSON.parse(res.json).orderDetail[3].value,
              // fibrinogen_i: JSON.parse(res.json).orderDetail[3].judgement === '偏低' ? 'L' : JSON.parse(res.json).orderDetail[0].judgement === '偏高' ? 'H' : '',
              // inr: JSON.parse(res.json).orderDetail[4].value,
              // inr_i: JSON.parse(res.json).orderDetail[4].judgement === '偏低' ? 'L' : JSON.parse(res.json).orderDetail[0].judgement === '偏高' ? 'H' : '',
              // version: res.version,
              // status: res.status,
              // judgement: res.judgement,
              // hasAudio: res.hasAudio,
              // hasPhoto: res.hasPhoto,
              // remarks: res.json.remarks
            }
          }
        })
        routineblood(data).then(res => {
          if (res.code === 0) {
            this.$message({
              message: '保存成功',
              type: 'success'
            })
            this.getBloodDataStroke()
          } else {
            this.$message({
              message: '保存失败',
              type: 'error'
            })
          }
        }).catch(err => {
          console.log(err)
        })
      } else if (type === 'renalAndElectrolytes') {
        instance = 'renalelec'
        this.strokeRenalAndElectrolytesList.forEach((res, index) => {
          if (index === newindex) {
            res.json.orderDetail.forEach(sub => {
              if (sub.value !== '') {
                this.allOnUse.forEach(alone => {
                  if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                    if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                      sub.judgement = '偏高'
                    } else if (Number(sub.value) < Number(alone.normalRangeStart)) {
                      sub.judgement = '偏低'
                    } else {
                      sub.judgement = '正常'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                    if (Number(sub.value) > Number(alone.normalRangeStart)) {
                      sub.judgement = '正常'
                    } else {
                      sub.judgement = '偏低'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                    if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                      sub.judgement = '偏高'
                    } else {
                      sub.judgement = '正常'
                    }
                  }
                })
              }
            })
            data = {
              id: res.id,
              excuteTime: res.json.bloodTime ? res.json.bloodTime : '',
              reportTime: res.json.resultTime ? res.json.resultTime : '',
              bloodTime: res.json.bloodTime ? res.json.bloodTime : '',
              resultTime: res.json.resultTime ? res.json.resultTime : '',
              userId: res.userId,
              missionId: res.missionId,
              medicalId: res.medicalId,
              instanceType: res.instanceType,
              itemName: res.itemName,
              itemType: type,
              polarity: res.polarity,
              crea: res.json.orderDetail.filter(item => { return item.abbr == '血清肌酐' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '血清肌酐' })[0].value : '', // varchar(16) DEFAULT '' comment '血清肌酐',
              crea_i: res.json.orderDetail.filter(item => { return item.abbr == '血清肌酐' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '血清肌酐' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '血清肌酐' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '血清肌酐',
              un: res.json.orderDetail.filter(item => { return item.abbr == '血清尿素氮' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '血清尿素氮' })[0].value : '', // varchar(16) DEFAULT '' comment '血清尿素氮',
              un_i: res.json.orderDetail.filter(item => { return item.abbr == '血清尿素氮' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '血清尿素氮' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '血清尿素氮' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '血清尿素氮',
              ua: res.json.orderDetail.filter(item => { return item.abbr == '尿酸' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '尿酸' })[0].value : '', // varchar(16) DEFAULT '' comment '尿酸',
              ua_i: res.json.orderDetail.filter(item => { return item.abbr == '尿酸' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '尿酸' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '尿酸' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '尿酸',
              ka: res.json.orderDetail.filter(item => { return item.abbr == '钾' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '钾' })[0].value : '', // varchar(16) DEFAULT '' comment '钾',
              ka_i: res.json.orderDetail.filter(item => { return item.abbr == '钾' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '钾' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '钾' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '钾',
              na: res.json.orderDetail.filter(item => { return item.abbr == '钠' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '钠' })[0].value : '', // varchar(16) DEFAULT '' comment '钠',
              na_i: res.json.orderDetail.filter(item => { return item.abbr == '钠' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '钠' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '钠' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '钠',
              cl: res.json.orderDetail.filter(item => { return item.abbr == '氯' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '氯' })[0].value : '', // varchar(16) DEFAULT '' comment ' 氯',
              cl_i: res.json.orderDetail.filter(item => { return item.abbr == '氯' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '氯' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '氯' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '氯',
              ga: res.json.orderDetail.filter(item => { return item.abbr == '钙' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '钙' })[0].value : '', // varchar(16) DEFAULT '' comment '钙',
              ga_i: res.json.orderDetail.filter(item => { return item.abbr == '钙' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '钙' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '钙' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '钙',
              iop: res.json.orderDetail.filter(item => { return item.abbr == '无机磷' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '无机磷' })[0].value : '', // varchar(16) DEFAULT '' comment ' 无机磷',
              iop_i: res.json.orderDetail.filter(item => { return item.abbr == '无机磷' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '无机磷' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '无机磷' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '无机磷'',
              mg: res.json.orderDetail.filter(item => { return item.abbr == '镁' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '镁' })[0].value : '', // varchar(16) DEFAULT '' comment ' 镁',
              mg_i: res.json.orderDetail.filter(item => { return item.abbr == '镁' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '镁' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '镁' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '镁',
              version: res.version,
              status: res.status,
              judgement: res.judgement,
              hasAudio: res.hasAudio,
              hasPhoto: res.hasPhoto,
              remarks: remark_vlaue
            }
          }
        })
      } else if (type === 'MyocardialEnzyme') {
        instance = 'myocardialenzyme'
        this.strokeMyocardialEnzymeList.forEach((res, index) => {
          if (index === newindex) {
            res.json.orderDetail.forEach(sub => {
              if (sub.value !== '') {
                this.allOnUse.forEach(alone => {
                  if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                    if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                      sub.judgement = '偏高'
                    } else if (Number(sub.value) < Number(alone.normalRangeStart)) {
                      sub.judgement = '偏低'
                    } else {
                      sub.judgement = '正常'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                    if (Number(sub.value) > Number(alone.normalRangeStart)) {
                      sub.judgement = '正常'
                    } else {
                      sub.judgement = '偏低'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                    if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                      sub.judgement = '偏高'
                    } else {
                      sub.judgement = '正常'
                    }
                  }
                })
              }
            })
            data = {
              id: res.id,
              excuteTime: res.json.bloodTime ? res.json.bloodTime : '',
              reportTime: res.json.resultTime ? res.json.resultTime : '',
              bloodTime: res.json.bloodTime ? res.json.bloodTime : '',
              resultTime: res.json.resultTime ? res.json.resultTime : '',
              userId: res.userId,
              missionId: res.missionId,
              medicalId: res.medicalId,
              instanceType: res.instanceType,
              itemName: res.itemName,
              itemType: type,
              polarity: res.polarity,
              hbdh: res.json.orderDetail.filter(item => { return item.abbr == '羟基丁酸脱氢酶' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '羟基丁酸脱氢酶' })[0].value : '',
              hbdh_i: res.json.orderDetail.filter(item => { return item.abbr == '羟基丁酸脱氢酶' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '羟基丁酸脱氢酶' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '羟基丁酸脱氢酶' })[0].judgement === '偏高' ? 'H' : '' : '',
              hbdh_u: res.json.orderDetail.filter(item => { return item.abbr == '羟基丁酸脱氢酶' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '羟基丁酸脱氢酶' })[0].unit : '',
              ck: res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶' })[0].value : '',
              ck_i: res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶' })[0].judgement === '偏高' ? 'H' : '' : '',
              ck_u: res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶' })[0].unit : '',
              ckmb: res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶同工酶' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶同工酶' })[0].value : '',
              ckmb_i: res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶同工酶' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶同工酶' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶同工酶' })[0].judgement === '偏高' ? 'H' : '' : '',
              ckmb_u: res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶同工酶' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶同工酶' })[0].unit : '',
              ldh: res.json.orderDetail.filter(item => { return item.abbr == '乳酸脱氢酶' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '乳酸脱氢酶' })[0].value : '',
              ldh_i: res.json.orderDetail.filter(item => { return item.abbr == '乳酸脱氢酶' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '乳酸脱氢酶' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '乳酸脱氢酶' })[0].judgement === '偏高' ? 'H' : '' : '',
              ldh_u: res.json.orderDetail.filter(item => { return item.abbr == '乳酸脱氢酶' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '乳酸脱氢酶' })[0].unit : '',
              version: res.version,
              status: res.status,
              judgement: res.judgement,
              hasAudio: res.hasAudio,
              hasPhoto: res.hasPhoto,
              remarks: remark_vlaue
            }
          }
        })
      } else if (type === 'other') {
        instance = 'biochemistry'
        this.strokeOtherList.forEach((res, index) => {
          if (index === newindex) {
            res.json.orderDetail.forEach(sub => {
              if (sub.value !== '') {
                this.allOnUse.forEach(alone => {
                  if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                    if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                      sub.judgement = '偏高'
                    } else if (Number(sub.value) < Number(alone.normalRangeStart)) {
                      sub.judgement = '偏低'
                    } else {
                      sub.judgement = '正常'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                    if (Number(sub.value) > Number(alone.normalRangeStart)) {
                      sub.judgement = '正常'
                    } else {
                      sub.judgement = '偏低'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                    if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                      sub.judgement = '偏高'
                    } else {
                      sub.judgement = '正常'
                    }
                  }
                })
              }
            })
            data = {
              id: res.id,
              excuteTime: res.json.bloodTime ? res.json.bloodTime : '',
              reportTime: res.json.resultTime ? res.json.resultTime : '',
              bloodTime: res.json.bloodTime ? res.json.bloodTime : '',
              resultTime: res.json.resultTime ? res.json.resultTime : '',
              userId: res.userId,
              missionId: res.missionId,
              medicalId: res.medicalId,
              instanceType: res.instanceType,
              itemName: res.itemName,
              itemType: type,
              polarity: res.polarity,
              troponin: res.json.orderDetail.filter(item => { return item.abbr == '肌钙蛋白' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌钙蛋白' })[0].value : '', // varchar(16) DEFAULT '' comment '肌钙蛋白',
              troponin_i: res.json.orderDetail.filter(item => { return item.abbr == '肌钙蛋白' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌钙蛋白' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '肌钙蛋白' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '肌钙蛋白',
              hcy: res.json.orderDetail.filter(item => { return item.abbr == '同型半胱氨酸' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '同型半胱氨酸' })[0].value : '', // varchar(16) DEFAULT '' comment '同型半胱氨酸',
              hcy_i: res.json.orderDetail.filter(item => { return item.abbr == '同型半胱氨酸' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '同型半胱氨酸' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '同型半胱氨酸' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '同型半胱氨酸',
              version: res.version,
              status: res.status,
              judgement: res.judgement,
              hasAudio: res.hasAudio,
              hasPhoto: res.hasPhoto,
              remarks: remark_vlaue
            }
          }
        })
      }
      if (!(type == 'coagulation' || type == 'boutineBloodTest')) {
        console.log(3)
        if (new Date(data.excuteTime).getTime() >= new Date(data.reportTime).getTime()) {
          this.$message({
            message: '报告时间不能小于等于抽血时间',
            type: 'warning'
          })
          return
        }

        StrokeBloodnew(instance, data).then(res => {
          this.$message({
            message: '保存成功',
            type: 'success'
          })
          this.getBloodDataStroke()
        }).catch(err => {
          console.log(err)
        })
      }
    }
  }
}
</script>

<style scoped>
#box {
  width: 100%;
  height: 100%;
}

.content {
  width: 100%;
  background-color: white;
  margin: 0px 0px 20px 0px;
  padding: 10px 20px;
  position: relative;
  border-bottom: 1px solid #DFDEE3;
}

.addContent {
  width: 100%;
  height: 50px;
  border-bottom: 1px solid #DFDEE3;
}

.trendContent {
  position: absolute;
  top: 0px;
  right: 20px;
}

.publicStyle {
  background-color: #F2F2F2;
  padding: 5px 20px;
  margin: 5px 0;
}

.publicDown {
  clear: both;
  margin: 0px 0 10px 0;
  padding-left: 32px;
  font-size: 14px;
}

.el-row {
  margin-bottom: 5px;
}

.el-col {
  margin-bottom: 5px;
}

.bg-purple-light {
  text-align: right;
}

.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
</style>
